<?php

declare(strict_types=1);

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

use Illuminate\Contracts\View\View;
use Seka\Terminy\Http\Controllers\Controller;
use Seka\Terminy\Models\MiestoKonania\MiestoKonania;

/**
 * Class AdresarController
 *
 * @package Seka\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);
    }
}
