<?php

namespace App\Providers;

use App\Events\InformaciaCreatedEvent;
use App\Events\InformaciaZverejnenaEvent;
use App\Events\Notifications\GetViewForNotification;
use App\Events\UserLoggedIn;
use App\Events\UserLoggedOut;
use App\Listeners\AktivitaOdhlaseniaPouzivatela;
use App\Listeners\AktivitaPrihlaseniaPouzivatela;
use App\Listeners\AktivitaVzdelavanieKniznicaKategoria;
use App\Listeners\AktivitaVzdelavanieKniznicaSekciaUcebnehoMaterialu;
use App\Listeners\AktivitaVzdelavanieKniznicaUcebnyMaterial;
use App\Listeners\AktivitaVzdelavanieTestovanieGenerovanieTestuPouzivatelom;
use App\Listeners\AktivitaVzdelavanieTestovanieSpustenieTestuPouzivatelom;
use App\Listeners\AktivitaVzdelavanieTestovanieVyhodnotenieTestuPouzivatelom;
use App\Listeners\FcmNotificationFailedListener;
use App\Listeners\InformaciaNotificationView;
use App\Listeners\LaravelLoginEventListener;
use App\Listeners\LaravelLogoutEventListener;
use App\Listeners\NastavitDatumovuPeciatkuPoslednehoPrihlasenia;
use App\Listeners\SendInformaciaPouzivatelNotificationListener;
use App\Listeners\SendInformaciaPouzivatelPushNotificationListener;
use App\Listeners\SendInformaciaPracoviskoNotificationListener;
use App\Listeners\UpozornitPouzivatelaNaNeprecitaneNotifikacie;
use App\Listeners\UvitaniePouzivatelaPoPrihlaseni;
use Illuminate\Auth\Events\Login;
use Illuminate\Auth\Events\Logout;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Notifications\Events\NotificationFailed;
use Seka\Vzdelavanie\Events\Kniznica\Backend\KategoriaCreated;
use Seka\Vzdelavanie\Events\Kniznica\Backend\KategoriaDeleted;
use Seka\Vzdelavanie\Events\Kniznica\Backend\KategoriaUpdated;
use Seka\Vzdelavanie\Events\Kniznica\Backend\SekciaCreated;
use Seka\Vzdelavanie\Events\Kniznica\Backend\SekciaDeleted;
use Seka\Vzdelavanie\Events\Kniznica\Backend\SekciaUpdated;
use Seka\Vzdelavanie\Events\Kniznica\Backend\UcebnyMaterialCreated;
use Seka\Vzdelavanie\Events\Kniznica\Backend\UcebnyMaterialDeleted;
use Seka\Vzdelavanie\Events\Kniznica\Backend\UcebnyMaterialUpdated;
use Seka\Vzdelavanie\Events\Kniznica\Frontend\SekciaOpened;
use Seka\Vzdelavanie\Events\Kniznica\Frontend\UcebnyMaterialOpened;
use Seka\Vzdelavanie\Events\Testovanie\Frontend\TestGenerated;
use Seka\Vzdelavanie\Events\Testovanie\Frontend\TestSpustenie;
use Seka\Vzdelavanie\Events\Testovanie\Frontend\TestVyhodnotenie;

/**
 * Class EventServiceProvider
 */
class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        // ***************************
        // FRONTEND
        // ***************************

        // LOGIN
        Login::class => [LaravelLoginEventListener::class],
        Logout::class => [LaravelLogoutEventListener::class],

        UserLoggedIn::class => [
            AktivitaPrihlaseniaPouzivatela::class,
            UvitaniePouzivatelaPoPrihlaseni::class,
            UpozornitPouzivatelaNaNeprecitaneNotifikacie::class,
            NastavitDatumovuPeciatkuPoslednehoPrihlasenia::class,
        ],
        UserLoggedOut::class => [AktivitaOdhlaseniaPouzivatela::class],

        // KNIZNICA
        UcebnyMaterialOpened::class => [AktivitaVzdelavanieKniznicaUcebnyMaterial::class],
        SekciaOpened::class => [AktivitaVzdelavanieKniznicaSekciaUcebnehoMaterialu::class],

        // TESTY
        TestSpustenie::class => [AktivitaVzdelavanieTestovanieSpustenieTestuPouzivatelom::class],
        TestGenerated::class => [AktivitaVzdelavanieTestovanieGenerovanieTestuPouzivatelom::class],
        TestVyhodnotenie::class => [AktivitaVzdelavanieTestovanieVyhodnotenieTestuPouzivatelom::class],

        // zobrazenie notifikacie v ramci zoznamu notifikacii pouzivatela v Portale
        GetViewForNotification::class => [
            InformaciaNotificationView::class,
        ],

        // ***************************
        // BACKEND
        // ***************************

        // KNIZNICA
        KategoriaCreated::class => [AktivitaVzdelavanieKniznicaKategoria::class],
        KategoriaUpdated::class => [AktivitaVzdelavanieKniznicaKategoria::class],
        KategoriaDeleted::class => [AktivitaVzdelavanieKniznicaKategoria::class],
        UcebnyMaterialCreated::class => [AktivitaVzdelavanieKniznicaUcebnyMaterial::class],
        UcebnyMaterialUpdated::class => [AktivitaVzdelavanieKniznicaUcebnyMaterial::class],
        UcebnyMaterialDeleted::class => [AktivitaVzdelavanieKniznicaUcebnyMaterial::class],
        SekciaCreated::class => [AktivitaVzdelavanieKniznicaSekciaUcebnehoMaterialu::class],
        SekciaUpdated::class => [AktivitaVzdelavanieKniznicaSekciaUcebnehoMaterialu::class],
        SekciaDeleted::class => [AktivitaVzdelavanieKniznicaSekciaUcebnehoMaterialu::class],

        NotificationFailed::class => [FcmNotificationFailedListener::class],

        InformaciaCreatedEvent::class => [],

        InformaciaZverejnenaEvent::class => [
            SendInformaciaPracoviskoNotificationListener::class,
            SendInformaciaPouzivatelNotificationListener::class,
            SendInformaciaPouzivatelPushNotificationListener::class,
        ],

    ];

    /**
     * Register any events for your application.
     */
    public function boot(): void {}

    /**
     * Determine if events and listeners should be automatically discovered.
     */
    public function shouldDiscoverEvents(): bool
    {
        return false;
    }
}
