<?php

declare(strict_types=1);

namespace Seka\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Components;

use Illuminate\Contracts\View\View;
use Seka\Terminy\Models\Udalost\Udalost;
use Seka\Terminy\Http\Controllers\Livewire\Components\Udalosti\Zoznam as ZoznamAbstract;

/**
 * Class Zoznam
 *
 * @package Seka\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Components
 */
final class Zoznam extends ZoznamAbstract
{
    /**
     * @var string
     */
    protected string $createPath = 'modul.terminy.backend.udalosti.udalost.create';

    /**
     * @var string
     */
    protected string $editPath = 'modul.terminy.backend.udalosti.udalost.edit';

    /**
     *
     */
    public function mount(): void
    {
        $this->udalosti = [];
    }

    /**
     * @return \Illuminate\Contracts\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function render(): View
    {
        $this->udalosti = $this->getQuery()->paginate(self::PER_PAGE);

        return view('Terminy::pages.udalosti.backend.livewire.components.zoznam')
            ->withUdalosti($this->udalosti)
            ->withCreatePath($this->createPath)
            ->withEditPath($this->editPath);
    }
}
