<?php

namespace App\Domain\Scraping\Domain\Model\ValueObject;

readonly class CbzGenerationRequest
{
    public function __construct(
        private string $mangaTitle,
        private string $publicationYear,
        private int $volumeNumber,
        private float $chapterNumber,
        private TempDirectory $sourceDirectory,
        private array $files
    ) {
        if (empty($mangaTitle)) {
            throw new \InvalidArgumentException('Manga title cannot be empty');
        }

        if (empty($publicationYear)) {
            throw new \InvalidArgumentException('Publication year cannot be empty');
        }

        if ($volumeNumber < 1) {
            throw new \InvalidArgumentException('Volume number must be greater than 0');
        }

        if ($chapterNumber <= 0) {
            throw new \InvalidArgumentException('Chapter number must be greater than 0');
        }

        if (empty($files)) {
            throw new \InvalidArgumentException('Files array cannot be empty');
        }
    }

    public function getMangaTitle(): string
    {
        return $this->mangaTitle;
    }

    public function getPublicationYear(): string
    {
        return $this->publicationYear;
    }

    public function getVolumeNumber(): int
    {
        return $this->volumeNumber;
    }

    public function getChapterNumber(): float
    {
        return $this->chapterNumber;
    }

    public function getSourceDirectory(): TempDirectory
    {
        return $this->sourceDirectory;
    }

    public function getFiles(): array
    {
        return $this->files;
    }
}
