<?php
/**
 * TOON Encoder Interface
 *
 * Defines the contract for encoding PHP arrays to TOON format.
 *
 * @package AIPT\Api\StoreIndex
 * @since 2.5.0
 */

namespace AIPT\Api\StoreIndex;

/**
 * ToonEncoderInterface
 *
 * Contract for TOON encoding operations.
 */
interface ToonEncoderInterface {

	/**
	 * Encode an index array to TOON format.
	 *
	 * @param array $index Index data with 'meta', 'products', 'categories' keys.
	 * @return string TOON-formatted string.
	 * @throws \InvalidArgumentException If index structure is invalid.
	 */
	public function encode( array $index ): string;

	/**
	 * Encode the meta section.
	 *
	 * @param array $meta Meta data array.
	 * @return string TOON-formatted meta section.
	 */
	public function encodeMeta( array $meta ): string;

	/**
	 * Encode the products section using tabular layout.
	 *
	 * @param array $products Products keyed by ID.
	 * @return string TOON-formatted products section.
	 */
	public function encodeProducts( array $products ): string;

	/**
	 * Encode the categories section.
	 *
	 * @param array $categories Categories keyed by ID.
	 * @return string TOON-formatted categories section.
	 */
	public function encodeCategories( array $categories ): string;
}
