<?php

declare(strict_types=1);

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

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

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

    /**
     * @return \Illuminate\Contracts\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function create(): View
    {
        $miesto = new MiestoKonania();

        return view('Terminy::pages.adresar.backend.nove')
            ->withMiesto($miesto);
    }

    /**
     * @param int $id
     *
     * @return \Illuminate\Contracts\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function edit(int $id): View
    {
        $miesto = MiestoKonania::withTrashed()->findOrFail($id);

        return view('Terminy::pages.adresar.backend.upravit')
            ->withMiesto($miesto);
    }
}
