<?hh // strict

namespace Tests\Services;

use App\Models\User;
use App\Services\ComplianceService;
use PHPUnit\Framework\TestCase;

class ComplianceServiceTest extends TestCase
{
    private ComplianceService $complianceService;
    
    protected function setUp(): void
    {
        $this->complianceService = new ComplianceService();
    }
    
    public function testUserDataCompliance(): void
    {
        $user = new User(
            id: 1,
            email: 'test@example.com',
            name: 'Test User',
            role: 'job_seeker',
            tenantId: 'tenant-123'
        );
        
        $this->assertTrue($this->complianceService->isUserDataCompliant($user));
    }
    
    public function testUserDataComplianceWithMissingName(): void
    {
        $user = new User(
            id: 1,
            email: 'test@example.com',
            name: '',
            role: 'job_seeker',
            tenantId: 'tenant-123'
        );
        
        $this->assertFalse($this->complianceService->isUserDataCompliant($user));
    }
    
    public function testUserDataComplianceWithMissingEmail(): void
    {
        $user = new User(
            id: 1,
            email: '',
            name: 'Test User',
            role: 'job_seeker',
            tenantId: 'tenant-123'
        );
        
        $this->assertFalse($this->complianceService->isUserDataCompliant($user));
    }
    
    public function testJobPostingCompliance(): void
    {
        $jobData = [
            'title' => 'Software Engineer',
            'description' => 'Looking for a skilled developer',
            'location' => 'New York'
        ];
        
        $this->assertTrue($this->complianceService->isJobPostingCompliant($jobData));
    }
    
    public function testJobPostingComplianceWithDiscriminatoryLanguage(): void
    {
        $jobData = [
            'title' => 'Software Engineer',
            'description' => 'Looking for a young male developer under 30',
            'location' => 'New York'
        ];
        
        $this->assertFalse($this->complianceService->isJobPostingCompliant($jobData));
    }
    
    public function testJobPostingComplianceWithMissingField(): void
    {
        $jobData = [
            'title' => 'Software Engineer',
            'description' => 'Looking for a skilled developer'
            // Missing location
        ];
        
        $this->assertFalse($this->complianceService->isJobPostingCompliant($jobData));
    }
}