<?php

declare(strict_types=1);

namespace App\Domain\Reader\Domain\ValueObject;

use InvalidArgumentException;

final class PageNumber
{
    private int $value;

    public function __construct(int $value)
    {
        if ($value < 1) {
            throw new InvalidArgumentException('Le numéro de page doit être supérieur à 0');
        }

        $this->value = $value;
    }

    public function getValue(): int
    {
        return $this->value;
    }

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

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