<?php
/**
 * Abstract base class for format exporters.
 *
 * @package Leadite
 */

namespace Leadite\Export;

defined( 'ABSPATH' ) || exit;

abstract class Exporter {

	/**
	 * Unique format slug (csv, xlsx, json, xml).
	 *
	 * @return string
	 */
	abstract public function format();

	/**
	 * Mime type of the output.
	 *
	 * @return string
	 */
	abstract public function mime_type();

	/**
	 * Perform the export and write output to stdout/output stream.
	 *
	 * @param array $leads Submissions list (each is a database row object).
	 * @return void
	 */
	abstract public function export( array $leads );

	/**
	 * Whether this exporter supports chunked streaming output.
	 *
	 * When true, handle_export() calls export_chunk() in a paginated loop so
	 * that memory usage is bounded regardless of dataset size. Formats that
	 * must buffer the entire output (XLSX, JSON, XML) return false and receive
	 * the full $leads array in a single export() call.
	 *
	 * @return bool
	 */
	public function supports_streaming(): bool {
		return false;
	}
}