<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Http\RequestHandlers\AddMediaFileAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Media;
use Fisharebest\Webtrees\Tree;

/**
 * @var string                   $max_upload_size
 * @var Media                    $media
 * @var array<int|string,string> $media_types
 * @var Tree                     $tree
 * @var array<string,string>     $unused_files
 */

?>

<form method="post" action="<?= e(route(AddMediaFileAction::class, ['xref' => $media->xref(), 'tree' => $media->tree()->name()])) ?>" enctype="multipart/form-data">
    <?= view('modals/header', ['title' => I18N::translate('Add a media file')]) ?>

    <div class="modal-body">
        <?= view('modals/media-file-fields', ['max_upload_size' => $max_upload_size, 'media_file' => null, 'media_types' => $media_types, 'tree' => $tree, 'unused_files' => $unused_files]) ?>
    </div>

    <?= view('modals/footer-save-cancel') ?>

    <?= csrf_field() ?>
</form>
