<?php

namespace MintyPHP\Service\User;

use MintyPHP\Repository\Access\UserRoleRepository;
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
use MintyPHP\Repository\Org\UserDepartmentRepository;
use MintyPHP\Repository\Org\UserDepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\UserTenantRepository;
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
use MintyPHP\Repository\User\UserListQueryRepository;
use MintyPHP\Repository\User\UserListQueryRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository;
use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserSavedFilterRepository;
use MintyPHP\Repository\User\UserSavedFilterRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepository;
use MintyPHP\Repository\User\UserWriteRepositoryInterface;

class UserRepositoryFactory
{
    private ?UserReadRepository $userReadRepository = null;
    private ?UserWriteRepository $userWriteRepository = null;
    private ?UserListQueryRepository $userListQueryRepository = null;
    private ?UserSavedFilterRepository $userSavedFilterRepository = null;
    private ?UserTenantRepository $userTenantRepository = null;
    private ?UserRoleRepository $userRoleRepository = null;
    private ?UserDepartmentRepository $userDepartmentRepository = null;

    public function createUserReadRepository(): UserReadRepositoryInterface
    {
        return $this->userReadRepository ??= new UserReadRepository();
    }

    public function createUserWriteRepository(): UserWriteRepositoryInterface
    {
        return $this->userWriteRepository ??= new UserWriteRepository();
    }

    public function createUserListQueryRepository(): UserListQueryRepositoryInterface
    {
        return $this->userListQueryRepository ??= new UserListQueryRepository();
    }

    public function createUserSavedFilterRepository(): UserSavedFilterRepositoryInterface
    {
        return $this->userSavedFilterRepository ??= new UserSavedFilterRepository();
    }

    public function createUserTenantRepository(): UserTenantRepositoryInterface
    {
        return $this->userTenantRepository ??= new UserTenantRepository();
    }

    public function createUserRoleRepository(): UserRoleRepositoryInterface
    {
        return $this->userRoleRepository ??= new UserRoleRepository();
    }

    public function createUserDepartmentRepository(): UserDepartmentRepositoryInterface
    {
        return $this->userDepartmentRepository ??= new UserDepartmentRepository();
    }
}
