<?php
/**
 * Result for importing detected affiliate-link products.
 *
 * @package Affilun\Application\Migration
 */

declare(strict_types=1);

namespace Affilun\Application\Migration;

/**
 * Small immutable summary returned by the import use case.
 */
final class ExternalAffiliateProductImportResult {

	/**
	 * Number of pending candidates detected before import.
	 */
	private int $detectedCount;

	/**
	 * Number of newly-created product rows.
	 */
	private int $importedCount;

	/**
	 * Number of updated product rows.
	 */
	private int $updatedCount;

	/**
	 * Construct an import result summary.
	 *
	 * @param int $detectedCount Pending candidates detected before import.
	 * @param int $importedCount Newly-created product rows.
	 * @param int $updatedCount  Updated product rows.
	 */
	public function __construct( int $detectedCount, int $importedCount, int $updatedCount ) {
		$this->detectedCount = $detectedCount;
		$this->importedCount = $importedCount;
		$this->updatedCount  = $updatedCount;
	}

	/**
	 * Pending candidates detected before import.
	 */
	public function detectedCount(): int {
		return $this->detectedCount;
	}

	/**
	 * Newly-created product rows.
	 */
	public function importedCount(): int {
		return $this->importedCount;
	}

	/**
	 * Updated product rows.
	 */
	public function updatedCount(): int {
		return $this->updatedCount;
	}

	/**
	 * Total created or updated rows.
	 */
	public function mutatedCount(): int {
		return $this->importedCount + $this->updatedCount;
	}
}
