<?php

namespace App\Providers;

use App\Events\Ecommerce\Channel\ChannelActiveStateChanged;
use App\Events\Ecommerce\Product\Category\CategoryTaxChanged;
use App\Events\Ecommerce\Product\Order\OrderCreated;
use App\Listeners\Ecommerce\Category\UpdateCategoryProductsPriceByTax;
use App\Listeners\Ecommerce\Channel\HideChannelProducts;
use App\Listeners\Ecommerce\Order\SendOrderCreatedNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event to listener mappings for the application.
     *
     * @var array<class-string, array<int, class-string>>
     */
    protected $listen = [
        // Orders...
        OrderCreated::class => [
            SendOrderCreatedNotification::class,
        ],

        // Categories...
        CategoryTaxChanged::class => [
            UpdateCategoryProductsPriceByTax::class,
        ],

        // Channel is active state changed...
        ChannelActiveStateChanged::class => [
            HideChannelProducts::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;
    }
}
