<?php

declare(strict_types=1);

namespace App\Domain\SmartLink\ValueObjects;

use App\Framework\DateTime\Clock;
use App\Framework\Ulid\Ulid;

final readonly class GeoRuleId
{
    private function __construct(
        public string $value
    ) {
    }

    public static function generate(Clock $clock): self
    {
        $ulid = new Ulid($clock);

        return new self($ulid->__toString());
    }

    public static function fromString(string $id): self
    {
        return new self($id);
    }

    public function toString(): string
    {
        return $this->value;
    }

    public function equals(self $other): bool
    {
        return $this->value === $other->value;
    }
}
