<?php

namespace App\Listeners;

use App\Events\PaymentCompleted;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Mail;
use Modules\Paypal\app\Emails\PaymentCompletedMail;

class SendMailPaymentCompleted
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(PaymentCompleted $event): void
    {
        Mail::send(
            new PaymentCompletedMail(
                payment_id: $event->payment_id,
                email: $event->email,
                name: $event->name,
                type: $event->type,
                product_name: $event->product_name,
                point: $event->point,
                discount_value: $event->discount_value,
                total_price: $event->total_price
            )
        );
    }
}
