<?php

namespace MintyPHP\Service\User;

use MintyPHP\Repository\Access\RoleRepositoryInterface;
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;

class UserDirectoryGateway
{
    public function __construct(
        private readonly TenantRepositoryInterface $tenantRepository,
        private readonly RoleRepositoryInterface $roleRepository,
        private readonly DepartmentRepositoryInterface $departmentRepository,
    ) {
    }

    public function listTenantIds(): array
    {
        return $this->tenantRepository->listIds();
    }

    public function listTenantsByIds(array $tenantIds): array
    {
        return $this->tenantRepository->listByIds($tenantIds);
    }

    public function findTenant(int $tenantId): ?array
    {
        return $this->tenantRepository->find($tenantId);
    }

    public function findTenantByUuid(string $tenantUuid): ?array
    {
        return $this->tenantRepository->findByUuid($tenantUuid);
    }

    public function listActiveTenantIdsByIds(array $tenantIds): array
    {
        return $this->tenantRepository->listActiveIdsByIds($tenantIds);
    }

    public function listActiveRoleIds(): array
    {
        return $this->roleRepository->listActiveIds();
    }

    public function listRolesByIds(array $roleIds): array
    {
        return $this->roleRepository->listByIds($roleIds);
    }

    public function listDepartmentsByIds(array $departmentIds, bool $includeInactive = true): array
    {
        return $this->departmentRepository->listByIds($departmentIds, $includeInactive);
    }

    public function listActiveDepartmentIdsByTenantIds(array $tenantIds): array
    {
        return $this->departmentRepository->listActiveIdsByTenantIds($tenantIds);
    }

    public function listDepartmentsByTenantIds(array $tenantIds): array
    {
        return $this->departmentRepository->listByTenantIds($tenantIds);
    }
}
