<?hh // strict

namespace Tests\Models;

use App\Models\Tenant;
use DateTime;
use PHPUnit\Framework\TestCase;

class TenantTest extends TestCase
{
    public function testTenantCreation(): void
    {
        $tenant = new Tenant(
            id: 'tenant-123',
            name: 'Test Tenant',
            subdomain: 'test',
            isActive: true
        );
        
        $this->assertEquals('tenant-123', $tenant->getId());
        $this->assertEquals('Test Tenant', $tenant->getName());
        $this->assertEquals('test', $tenant->getSubdomain());
        $this->assertTrue($tenant->getIsActive());
        $this->assertInstanceOf(DateTime::class, $tenant->getCreatedAt());
        $this->assertInstanceOf(DateTime::class, $tenant->getUpdatedAt());
    }
    
    public function testTenantSetters(): void
    {
        $tenant = new Tenant(
            id: 'tenant-123',
            name: 'Test Tenant',
            subdomain: 'test',
            isActive: true
        );
        
        $originalUpdatedAt = $tenant->getUpdatedAt();
        
        // Update the tenant
        $tenant->setName('Updated Test Tenant');
        $tenant->setSubdomain('updated-test');
        $tenant->setIsActive(false);
        
        // Verify updates
        $this->assertEquals('Updated Test Tenant', $tenant->getName());
        $this->assertEquals('updated-test', $tenant->getSubdomain());
        $this->assertFalse($tenant->getIsActive());
        
        // Verify that updated_at was updated
        $this->assertNotEquals($originalUpdatedAt, $tenant->getUpdatedAt());
    }
}