<?php

namespace App\Tests\Entity;

use App\Entity\OrderNumber;
use PHPUnit\Framework\TestCase;

class OrderNumberTest extends TestCase
{
    public function testConstructor(): void
    {
        $order = new OrderNumber('04/2026-00001');

        $this->assertNull($order->getId());
        $this->assertSame('04/2026-00001', $order->getNumOrder());
        $this->assertInstanceOf(\DateTimeImmutable::class, $order->getCreatedAt());
        $this->assertFalse($order->isUsed());
    }

    public function testMarkAsUsed(): void
    {
        $order = new OrderNumber('04/2026-00002');
        $this->assertFalse($order->isUsed());

        $order->markAsUsed();
        $this->assertTrue($order->isUsed());
    }

    public function testMarkAsUnused(): void
    {
        $order = new OrderNumber('04/2026-00003');
        $order->markAsUsed();
        $this->assertTrue($order->isUsed());

        $order->markAsUnused();
        $this->assertFalse($order->isUsed());
    }
}
