<?php

namespace App\Providers;

use App\Events\CustomerCreated;
use App\Events\OrderConfirmed;
use App\Events\OrderClosed;
use App\Events\TransactionSettled;
use App\Listeners\LogOrderConfirmed;
use App\Listeners\LogTransactionSettled;
use App\Listeners\SendOrderConfirmationSms;
use App\Listeners\SendTransactionSettledSms;
use App\Listeners\SendWelcomeSms;
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 = [
        // Order Events
        OrderConfirmed::class => [
            LogOrderConfirmed::class,
            SendOrderConfirmationSms::class,
        ],
        
        OrderClosed::class => [
            // Add listeners as needed
        ],
        
        // Transaction Events
        TransactionSettled::class => [
            LogTransactionSettled::class,
            SendTransactionSettledSms::class,
        ],
        
        // Customer Events
        CustomerCreated::class => [
            SendWelcomeSms::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;
    }
}
