<?php

require_once __DIR__ . '/SegmentSeatAvailabilityBootstrap.php';

use Modules\Offer\Models\OfferModel;
use PHPUnit\Framework\TestCase;

final class OfferModelStatusTest extends TestCase
{
    public function testOfferIsActiveWithinDateRange(): void
    {
        $this->assertTrue(OfferModel::isOfferActive('2026-01-01', '2026-12-31', '2026-06-15'));
    }

    public function testOfferIsInactiveBeforeStartDate(): void
    {
        $this->assertFalse(OfferModel::isOfferActive('2026-07-01', '2026-12-31', '2026-06-15'));
    }

    public function testNormalizeStoredDateAcceptsEgyptSlashFormat(): void
    {
        $this->assertSame('2026-06-26', OfferModel::normalizeStoredDate('26/06/2026'));
    }

    public function testNormalizeStoredDateAcceptsEgyptDashFormat(): void
    {
        $this->assertSame('2026-06-26', OfferModel::normalizeStoredDate('26-06-2026'));
    }

    public function testFormatDisplayDateUsesEgyptDayMonthYear(): void
    {
        $this->assertSame('26/06/2026', OfferModel::formatDisplayDate('2026-06-26'));
        $this->assertSame('01/01/2026', OfferModel::formatDisplayDate('2026-01-01'));
    }
}
