<?php
/**
 * Contract for fetching the raw catalog that CandidateIndex indexes.
 *
 * @package EmberPrice
 */

namespace EmberPrice\Matching;

/**
 * Kept separate from CandidateIndex so the index itself stays pure and
 * unit-testable without WordPress: production code fetches from WooCommerce
 * (see WooCommerceCatalogRepository), tests supply a fixture-backed stub.
 */
interface CatalogRepositoryInterface {

	/**
	 * One entry per published product. Variable products carry a
	 * `variations` entry with one row per variation instead of being
	 * indexed as a purchasable candidate themselves.
	 *
	 * @return iterable<array{
	 *     product_id: int,
	 *     sku: string,
	 *     gtin?: string,
	 *     brand?: string,
	 *     title: string,
	 *     variations?: array<int, array{variation_id: int, sku: string, gtin?: string, brand?: string, title: string}>
	 * }>
	 */
	public function get_products(): iterable;
}
