<?php

namespace MintyPHP\Tests\Service\Audit;

use MintyPHP\Repository\Audit\ApiAuditLogRepository;
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
use MintyPHP\Service\Audit\ApiAuditService;
use MintyPHP\Service\Audit\AuditServicesFactory;
use MintyPHP\Service\Audit\UserLifecycleAuditService;
use PHPUnit\Framework\TestCase;

class AuditServicesFactoryTest extends TestCase
{
    public function testFactoryReturnsStableInstancesPerFactoryObject(): void
    {
        $factory = new AuditServicesFactory();

        $this->assertInstanceOf(ApiAuditLogRepository::class, $factory->createApiAuditLogRepository());
        $this->assertSame($factory->createApiAuditLogRepository(), $factory->createApiAuditLogRepository());

        $this->assertInstanceOf(UserLifecycleAuditRepository::class, $factory->createUserLifecycleAuditRepository());
        $this->assertSame($factory->createUserLifecycleAuditRepository(), $factory->createUserLifecycleAuditRepository());

        $this->assertInstanceOf(ApiAuditService::class, $factory->createApiAuditService());
        $this->assertSame($factory->createApiAuditService(), $factory->createApiAuditService());

        $this->assertInstanceOf(UserLifecycleAuditService::class, $factory->createUserLifecycleAuditService());
        $this->assertSame($factory->createUserLifecycleAuditService(), $factory->createUserLifecycleAuditService());
    }
}
