<?php
/**
 * Jingga
 *
 * PHP Version 8.1
 *
 * @package   Modules\Media\Controller
 * @copyright Dennis Eichhorn
 * @license   OMS License 2.0
 * @version   1.0.0
 * @link      https://jingga.app
 */
declare(strict_types=1);

namespace Modules\Media\Controller;

use phpOMS\Asset\AssetType;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;

/**
 * Trait for setting up file upload functionality.
 *
 * @package Modules\Media\Controller
 * @license OMS License 2.0
 * @link    https://jingga.app
 * @since   1.0.0
 */
trait FileUploaderTrait
{
    /**
     * Setup file uploader.
     *
     * @param RequestAbstract  $request  Request
     * @param ResponseAbstract $response Response
     * @param mixed            $data     Misc. data
     *
     * @return void
     *
     * @since 1.0.0
     * @codeCoverageIgnore
     */
    public static function setUpFileUploaderTrait(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
    {
        $head = $response->data['Content']->head;
        $head->addAsset(AssetType::JS, '/Modules/Media/Controller.js', ['type' => 'module']);
    }
}
