<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class CustomerOrder
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $payment_id;    
    public $email;        
    public $name;          
    public $type;          
    public $product_name;
    public $point;    
    public $discount_value;
    public $total_price;   
    /**
     * Create a new event instance.
     */
    public function __construct($payment_id, $email, $name, $type, $product_name, $point, $discount_value, $total_price)
    {
        $this->payment_id = $payment_id;
        $this->email = $email;
        $this->name = $name;
        $this->type = $type;
        $this->product_name = $product_name;
        $this->point = $point;
        $this->discount_value = $discount_value;
        $this->total_price = $total_price;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return array<int, \Illuminate\Broadcasting\Channel>
     */
    public function broadcastOn(): array
    {
        return [
            new PrivateChannel('CustomerOrder'),
        ];
    }
}