<?php

namespace MintyPHP\Service\Access;

use MintyPHP\Repository\Access\PermissionRepository;
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
use MintyPHP\Repository\Access\RolePermissionRepository;
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
use MintyPHP\Repository\Access\UserRoleRepository;
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;

class AccessRepositoryFactory
{
    private ?PermissionRepository $permissionRepository = null;
    private ?RolePermissionRepository $rolePermissionRepository = null;
    private ?UserRoleRepository $userRoleRepository = null;

    public function createPermissionRepository(): PermissionRepositoryInterface
    {
        return $this->permissionRepository ??= new PermissionRepository();
    }

    public function createRolePermissionRepository(): RolePermissionRepositoryInterface
    {
        return $this->rolePermissionRepository ??= new RolePermissionRepository();
    }

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