<?php

namespace CelerSearch\DataTransfer\IndexResponses;

use CelerSearch\Abstracts\IndexResponse;

/**
 * Response DTO for paginated document listings (Browser / debug tool).
 *
 * Providers that support paginated document retrieval populate this via
 * IndexResponseBuilder. Shape is provider-neutral: documents are raw
 * associative arrays, no field is interpreted.
 */
class DocumentListResponse extends IndexResponse {

	/**
	 * The documents returned for this page.
	 *
	 * @var array<int, array<string, mixed>>
	 */
	public array $documents = [];

	/**
	 * Total number of documents in the index (not just this page).
	 *
	 * @var int
	 */
	public int $total = 0;

	/**
	 * Offset requested for this page.
	 *
	 * @var int
	 */
	public int $offset = 0;

	/**
	 * Limit requested for this page.
	 *
	 * @var int
	 */
	public int $limit = 0;

	public function set_documents( array $documents ): void {
		$this->documents = $documents;
	}

	public function get_documents(): array {
		return $this->documents;
	}

	public function set_total( int $total ): void {
		$this->total = $total;
	}

	public function get_total(): int {
		return $this->total;
	}

	public function set_offset( int $offset ): void {
		$this->offset = $offset;
	}

	public function get_offset(): int {
		return $this->offset;
	}

	public function set_limit( int $limit ): void {
		$this->limit = $limit;
	}

	public function get_limit(): int {
		return $this->limit;
	}

	public function is_error_response(): bool {
		return false;
	}
}
