<?php

declare(strict_types=1);

namespace App\Infrastructure\Api\RapidMail;

final readonly class MailingId
{
    public function __construct(
        public int $value
    ) {
        if ($value <= 0) {
            throw new \InvalidArgumentException('MailingId must be positive');
        }
    }

    public static function fromInt(int $id): MailingId
    {
        return new MailingId($id);
    }

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

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