<?php

declare(strict_types=1);

namespace apexl\Io\modules\mirror\Interface;

use apexl\Io\modules\mirror\Dto\UploadedObjectDto;
use apexl\Io\modules\mirror\Exception\UploaderException;

interface UploaderServiceInterface
{
    /**
     * Filter hook fired during upload with the storage driver's upload
     * parameters as an associative array, the {@see Uploadable} being uploaded,
     * and the uploader service. Listeners return the (possibly modified) array.
     *
     * For the S3 driver these are PutObject params, e.g. `ContentType`,
     * `ContentDisposition`, `CacheControl`, `Metadata`.
     *
     * Signature: `fn(array $params, Uploadable $uploadable, UploaderServiceInterface $uploader): array`
     */
    public const string HOOK__GET_UPLOAD_PARAMS = 'mirror.uploader.get_upload_params';

    /**
     * @param  Uploadable[]  $toUpload
     */
    public function uploadAll(array $toUpload): void;

    public function upload(Uploadable $uploadable): void;

    public function isUploaded(string $key): bool;

    /**
     * @throws  UploaderException
     */
    public function getUploaded(string $key): UploadedObjectDto;
}
