<?php

declare(strict_types=1);

namespace App\Tests\Unit\Administration\Domain\Model\ActivationToken;

use App\Administration\Domain\Model\ActivationToken\ActivationTokenId;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Ramsey\Uuid\Uuid;

final class ActivationTokenIdTest extends TestCase
{
    #[Test]
    public function generateCreatesValidUuid(): void
    {
        $id = ActivationTokenId::generate();

        self::assertInstanceOf(ActivationTokenId::class, $id);
        self::assertTrue(Uuid::isValid((string) $id));
    }

    #[Test]
    public function fromStringCreatesIdFromValidUuid(): void
    {
        $uuid = '550e8400-e29b-41d4-a716-446655440000';
        $id = ActivationTokenId::fromString($uuid);

        self::assertSame($uuid, (string) $id);
    }

    #[Test]
    public function equalsReturnsTrueForSameValue(): void
    {
        $uuid = '550e8400-e29b-41d4-a716-446655440000';
        $id1 = ActivationTokenId::fromString($uuid);
        $id2 = ActivationTokenId::fromString($uuid);

        self::assertTrue($id1->equals($id2));
    }

    #[Test]
    public function equalsReturnsFalseForDifferentValue(): void
    {
        $id1 = ActivationTokenId::generate();
        $id2 = ActivationTokenId::generate();

        self::assertFalse($id1->equals($id2));
    }
}
