<?php

namespace MintyPHP\Service\CustomField;

use MintyPHP\Repository\Tenant\TenantRepository;
use MintyPHP\Service\Tenant\TenantScopeService;

class CustomFieldServicesFactory
{
    private ?TenantCustomFieldService $tenantCustomFieldService = null;
    private ?UserCustomFieldValueService $userCustomFieldValueService = null;

    public function __construct(
        private readonly TenantRepository $tenantRepository,
        private readonly TenantScopeService $userScopeGateway
    ) {
    }

    public function createTenantCustomFieldService(): TenantCustomFieldService
    {
        return $this->tenantCustomFieldService ??= new TenantCustomFieldService($this->tenantRepository);
    }

    public function createUserCustomFieldValueService(): UserCustomFieldValueService
    {
        return $this->userCustomFieldValueService ??= new UserCustomFieldValueService($this->userScopeGateway);
    }
}
