<?php

namespace App\Http\Controllers\Backend\Informacie;

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

/**
 * Class ShowCreatePage
 *
 * @package App\Http\Controllers\Backend\Informacie
 */
class ShowCreatePage extends Controller
{
    /**
     * @var \App\Repositories\InformaciaRepositoryContract
     */
    private InformaciaRepositoryContract $informaciaRepository;

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

    /**
     * @return Application|Factory|View
     *
     * @throws RepositoryException
     */
    public function __invoke()
    {
        $informacie = $this->informaciaRepository->makeModel();
        $informacie->stav = StavInformacieEnum::ROZPISANA();

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