<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Terminy\Providers;

use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Seka\Portal\Modul\Terminy\Composers\Udalosti\ZoznamBuducichUdalostiComposer;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Adresar\Livewire\Components\Form as AdresarFormComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Adresar\Livewire\Components\Zoznam as AdresarZoznamComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Adresar\Livewire\Pages\Index as AdresarIndexPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Adresar\Livewire\Pages\Nove as AdresarNovePage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Adresar\Livewire\Pages\Upravit as AdresarUpravitPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\MoznostiUdalosti\Livewire\Components\Form as MoznostiUdalostiFormComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\MoznostiUdalosti\Livewire\Components\Zoznam as MoznostiUdalostiZoznamComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\MoznostiUdalosti\Livewire\Pages\Index as MoznostiUdalostiIndexPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\MoznostiUdalosti\Livewire\Pages\Nove as MoznostiUdalostiNovePage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\MoznostiUdalosti\Livewire\Pages\Upravit as MoznostiUdalostiUpravitPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Registracie\Livewire\Components\Form as RegistracieFormComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Components\Form as UdalostiFormComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Components\MoznostiUdalosti\Form;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Components\Zoznam as UdalostiZoznamComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Pages\Index as UdalostiIndexPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Pages\Nova as UdalostiNovaPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Backend\Udalosti\Livewire\Pages\Upravit as UdalostiUpravitPage;
use Seka\Portal\Modul\Terminy\Http\Controllers\Frontend\Registracie\Livewire\Components\Form as FrontendRegistracieFormComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Frontend\Registracie\Livewire\Components\RegistraciaMoznostiUdalostiForm;
use Seka\Portal\Modul\Terminy\Http\Controllers\Livewire\Components\Udalosti\Druh as UdalostiDruhComponent;
use Seka\Portal\Modul\Terminy\Http\Controllers\Livewire\Components\Udalosti\Stav as UdalostiStavComponent;

/**
 * Class ViewServiceProvider
 *
 * @package Seka\Portal\Modul\Terminy\Providers
 */
final class ViewServiceProvider extends ServiceProvider
{
    /**
     * @return void
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function boot(): void
    {
        $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'Terminy');
        $this->loadLivewireComponents();
    }

    /**
     * @return void
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function register()
    {
        $this->registerComposers();
    }

    /**
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function registerComposers(): void
    {
        view()->composer(
            ['Terminy::pages.udalosti.frontend.show'],
            ZoznamBuducichUdalostiComposer::class
        );
    }

    /**
     * @return void
     */
    private function loadLivewireComponents(): void
    {
        // PAGES
        Livewire::component('Terminy::pages.adresar.backend.livewire.nove', AdresarNovePage::class);
        Livewire::component('Terminy::pages.adresar.backend.livewire.index', AdresarIndexPage::class);
        Livewire::component('Terminy::pages.adresar.backend.livewire.upravit', AdresarUpravitPage::class);
        Livewire::component('Terminy::pages.moznostiUdalosti.backend.livewire.nove', MoznostiUdalostiNovePage::class);
        Livewire::component('Terminy::pages.moznostiUdalosti.backend.livewire.index', MoznostiUdalostiIndexPage::class);
        Livewire::component('Terminy::pages.moznostiUdalosti.backend.livewire.upravit', MoznostiUdalostiUpravitPage::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.nova', UdalostiNovaPage::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.index', UdalostiIndexPage::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.upravit', UdalostiUpravitPage::class);

        // COMPONENTS
        Livewire::component('Terminy::components.livewire.udalosti.druh', UdalostiDruhComponent::class);
        Livewire::component('Terminy::components.livewire.udalosti.stav', UdalostiStavComponent::class);
        Livewire::component('Terminy::pages.adresar.backend.livewire.components.form', AdresarFormComponent::class);
        Livewire::component('Terminy::pages.adresar.backend.livewire.components.zoznam', AdresarZoznamComponent::class);
        Livewire::component('Terminy::pages.moznostiUdalosti.backend.livewire.components.form', MoznostiUdalostiFormComponent::class);
        Livewire::component('Terminy::pages.moznostiUdalosti.backend.livewire.components.zoznam', MoznostiUdalostiZoznamComponent::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.components.form', UdalostiFormComponent::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.components.zoznam', UdalostiZoznamComponent::class);
        Livewire::component('Terminy::pages.udalosti.registracie.backend.livewire.components.form', RegistracieFormComponent::class);
        Livewire::component('Terminy::pages.udalosti.registracie.frontend.livewire.components.form', FrontendRegistracieFormComponent::class);
        Livewire::component('Terminy::pages.udalosti.registracie.frontend.livewire.components.registracia_moznosti_udalosti_form', RegistraciaMoznostiUdalostiForm::class);
        Livewire::component('Terminy::pages.udalosti.backend.livewire.components.moznostiUdalosti.form', Form::class);
    }
}
