<?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
{
    /**
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function index(int $udalostId): View
    {
        $udalost = Udalost::withTrashed()->with('registracie')->findOrFail($udalostId);
        $moznostiUdalosti = MoznostUdalosti::query()->get();
        $pocetRegistracii = $udalost->registracie()->count();

        return view(
            'Terminy::pages.backend.udalosti.moznosti-udalosti.index',
            compact('udalost', 'pocetRegistracii', 'moznostiUdalosti'),
        );
    }
}
