<?php

declare(strict_types=1);

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

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

/**
 * Class UdalostiController
 *
 * @package Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti
 */
final class UdalostiController extends Controller
{
    /**
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function index(): View
    {
        return view('Terminy::pages.backend.udalosti.index');
    }

    /**
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function create(): View
    {
        return view('Terminy::pages.backend.udalosti.nova');
    }

    /**
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function edit(int $mtUdalostId): View
    {
        // moznost upravit musi mat aj zneplatnena (trashed) udalost
        $udalost = Udalost::withTrashed()
            ->with('registracie', 'miestoKonania')
            ->findOrFail($mtUdalostId);

        return view('Terminy::pages.backend.udalosti.upravit', compact('udalost'));
    }
}
