<?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
 */
class ShowCreatePage extends Controller
{
    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);
    }
}
