<?php

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

readonly class ScrapingResult
{
    public function __construct(
        private array $imageUrls,
        private int $totalPages
    ) {
        foreach ($imageUrls as $url) {
            if (!filter_var($url, FILTER_VALIDATE_URL)) {
                throw new \InvalidArgumentException('Invalid image URL provided: ' . $url);
            }
        }

        if ($totalPages !== count($imageUrls)) {
            throw new \InvalidArgumentException('Total pages must match the number of image URLs');
        }
    }

    public function getImageUrls(): array
    {
        return $this->imageUrls;
    }

    public function getTotalPages(): int
    {
        return $this->totalPages;
    }
}
