<?php
/**
 * Scheduled link-health candidate batch.
 *
 * @package Affilun\Application\LinkHealth
 */

declare(strict_types=1);

namespace Affilun\Application\LinkHealth;

/**
 * Immutable list of URLs and product contexts selected for one cron tick.
 */
final class ScheduledLinkHealthCandidateBatch {

	/**
	 * @param list<string>                      $urls            URLs to submit.
	 * @param array<string,array<string,mixed>> $contexts        Context keyed by URL.
	 * @param int                               $scannedProducts Number of product rows scanned.
	 * @param int                               $nextPage        Next cursor page.
	 */
	public function __construct(
		private array $urls,
		private array $contexts,
		private int $scannedProducts,
		private int $nextPage
	) {}

	/**
	 * URLs to submit.
	 *
	 * @return list<string>
	 */
	public function urls(): array {
		return $this->urls;
	}

	/**
	 * Context keyed by URL.
	 *
	 * @return array<string,array<string,mixed>>
	 */
	public function contexts(): array {
		return $this->contexts;
	}

	/**
	 * Number of product rows scanned.
	 */
	public function scannedProducts(): int {
		return $this->scannedProducts;
	}

	/**
	 * Next cursor page.
	 */
	public function nextPage(): int {
		return $this->nextPage;
	}

	/**
	 * Whether no URLs were selected for submission.
	 */
	public function isEmpty(): bool {
		return $this->urls === array();
	}
}
