<?php

namespace interfaces;

use Exception;
use InvalidArgumentException;
use RuntimeException;

interface image_processor_i
{
    /**
     * Sets the image base64 string.
     * @param string $base64 The base64 encoded image string.
     * @return void
     */
    public function set_image_base64(string $base64): void;
    /**
     * Gets the image base64 string.
     * @return string The base64 encoded image string.
     */
    function get_image_base64(): string;
    /**
     * Processes the image with the given parameters.
     * @param array $params An associative array of parameters for processing the image.
     * @return bool Returns true if the image was processed successfully, false otherwise.
     * @note This method is abstract and must be implemented by the class that implements this interface.
     * @throws Exception If the image processing fails.
     * @throws InvalidArgumentException If the parameters are invalid.
     * @throws RuntimeException If there is an error during processing.
     */
    public function process_image(array $params): bool;
    /**
     * Gets the image format.
     * @return string The format of the image (e.g., 'jpeg', 'png', 'gif').
     * @throws RuntimeException If the image format cannot be determined.
     */
    public function get_image_format(): string;
    /**
     * Process the image with ocrSpace.
     * @return array An associative array containing the OCR results.
     * @throws RuntimeException If the OCR processing fails.
     * @throws InvalidArgumentException If the image is not set or is invalid.
     * @throws Exception If there is a general error during OCR processing.
     * @note This method is abstract and must be implemented by the class that implements this interface.
     */
    public function process_ocr(): array;

}