<?php

namespace App\Http\Controllers\Backend\Informacie;

use App\Http\Controllers\Controller;
use App\Models\Informacia\Enums\StavInformacieEnum;
use App\Repositories\InformaciaRepositoryContract;
use Illuminate\View\View;
use Prettus\Repository\Exceptions\RepositoryException;

/**
 * Class ShowCreatePage
 */
class ShowCreatePage extends Controller
{
    private InformaciaRepositoryContract $informaciaRepository;

    /**
     * PouzivateliaController constructor.
     */
    public function __construct(InformaciaRepositoryContract $informaciaRepository)
    {
        $this->informaciaRepository = $informaciaRepository;
    }

    /**
     * @throws RepositoryException
     */
    public function __invoke(): View
    {
        /** @var \App\Models\Informacia\Informacia $informacia */
        $informacia = $this->informaciaRepository->makeModel();
        $informacia->stav = StavInformacieEnum::ROZPISANA;

        return view('pages.backend.informacie.create')->withInformacia($informacia);
    }
}
