<?php

declare(strict_types=1);

namespace App\Domain\Manga\Application\Response;

readonly class MangaMatchResponse
{
    /**
     * @param MangaMatchItem[] $matches
     */
    public function __construct(
        public array $matches,
        public ?float $chapterNumber,
        public ?float $volumeNumber,
        public array $possibleTitles
    ) {
    }

    public function hasMatches(): bool
    {
        return count($this->matches) > 0;
    }

    public function getBestMatch(): ?MangaMatchItem
    {
        return $this->matches[0] ?? null;
    }
}
