<?php

declare(strict_types=1);

namespace App\Framework\Notification\Channels\Telegram\ValueObjects;

/**
 * Telegram Message ID Value Object
 *
 * Represents a unique message identifier returned by Telegram API
 */
final readonly class TelegramMessageId
{
    public function __construct(
        public int $value
    ) {
        if ($value <= 0) {
            throw new \InvalidArgumentException('Telegram message ID must be positive');
        }
    }

    public static function fromInt(int $value): self
    {
        return new self($value);
    }

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

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

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