<?php

declare(strict_types=1);

namespace App\Framework\GraphQL\Subscriptions;

/**
 * Unique identifier for a subscription
 */
final readonly class SubscriptionId
{
    public function __construct(
        public string $value
    ) {
    }

    public static function generate(): self
    {
        return new self(uniqid('sub_', true));
    }

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

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

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