<?php
declare(strict_types=1);

namespace App\Service\Export;

use App\ApiResources\Export\ExportRequest;
use App\Entity\Core\File;
use App\Service\Export\Model\ExportModelInterface;

/**
 * Classe de base des services d'export
 */
interface ExporterInterface
{
    /**
     * Le service supporte-t-il ce type d'ExportRequest
     *
     * @param ExportRequest $exportRequest
     * @return boolean
     */
    public function support(ExportRequest $exportRequest): bool;

    /**
     * Exécute l'opération d'export correspondant à la requête passée
     * en paramètre
     *
     * @param ExportRequest $exportRequest
     */
    public function export(ExportRequest $exportRequest): File;

    /**
     * Create a pending file record in the database
     *
     * @param ExportRequest $exportRequest
     * @param bool $flushFile
     * @return File
     */
    public function prepareFile(ExportRequest $exportRequest, bool $flushFile = true): File;

    /**
     * Construit le modèle de données qui servira au render du template
     *
     * @param ExportRequest $exportRequest
     * @return ExportModelInterface
     */
    public function buildModel(ExportRequest $exportRequest): ExportModelInterface;
}
