<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti;

use Illuminate\View\View;
use Seka\Portal\Modul\Terminy\Entities\MoznostiUdalosti\MoznostUdalosti;
use Seka\Portal\Modul\Terminy\Entities\Udalost\Udalost;
use Seka\Portal\Modul\Terminy\Http\Controllers\Controller;

/**
 * Class MoznostiUdalostiController
 *
 * @package Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti
 */
final class MoznostiUdalostiController extends  Controller
{
    /**
     * @param int $udalostId
     *
     * @return \Illuminate\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function index(int $udalostId): View
    {
        /** @var \Seka\Portal\Modul\Terminy\Entities\Udalost\Udalost $udalost */
        $udalost = Udalost::query()
            ->withTrashed()
            ->findOrFail($udalostId);
        $moznostiUdalosti = MoznostUdalosti::query()
            ->get();

        return view('Terminy::pages.udalosti.moznosti.backend.index')
            ->withUdalost($udalost)
            ->withMoznostiUdalosti($moznostiUdalosti);
    }
}
