<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class OrderWebSubmittedMail extends Mailable
{
    use Queueable, SerializesModels;
    public $fromEmail;
    public $toEmail;
    public $ccEmails;
    public $order_id;
    public $customer_name;
    // public $weight;
    public $extractedCardDetails;
    public $sub_total;
    public $order_status;
    public $gst_value;
    public $delivery_charge;
    public $payment_method;
    public $product_overall_total;
    public $deliveryDetails;
    public $order_description;


 
    /**
     * Create a new message instance.
     *
     * @param string $fromEmail
     * @param string $toEmail
     */
    public function __construct($fromEmail, $toEmail, $ccEmails, $order_id, $customer_name,  $extractedCardDetails, $sub_total, $order_status, $gst_value, $delivery_charge, $payment_method, $product_overall_total, $deliveryDetails, $order_description)
    {
        $this->fromEmail = $fromEmail;
        $this->toEmail = $toEmail;
        $this->ccEmails = $ccEmails;
        $this->order_id = $order_id;
        $this->customer_name = $customer_name;
        // $this->weight = $weight;
        $this->extractedCardDetails = $extractedCardDetails;
        $this->sub_total = $sub_total;
        $this->order_status = $order_status;
        $this->gst_value = $gst_value;
        $this->delivery_charge = $delivery_charge;
        $this->payment_method = $payment_method;
        $this->product_overall_total = $product_overall_total;
        $this->deliveryDetails = $deliveryDetails;
        $this->order_description = $order_description;



    }
 
    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from('your-email@example.com', $this->fromEmail)
                    ->subject('Order Placed - Shanlax Publications')
                    ->view('emails.submittedwebordermail')
                    ->with([
                        'fromEmail' => $this->fromEmail,
                        'toEmail' => $this->toEmail,
                        'order_id' => $this->order_id,
                        'customer_name' => $this->customer_name,
                        // 'weight' => $this->weight,
                        'extractedCardDetails' => $this->extractedCardDetails, // Add this line
                        'sub_total' => $this->sub_total, // Add this line
                        'order_status' => $this->order_status, // Add this line
                        'gst_value' => $this->gst_value, // Add this line
                        'delivery_charge' => $this->delivery_charge, // Add this line
                        'payment_method' => $this->payment_method, // Add this line
                        'product_overall_total' => $this->product_overall_total, // Add this line
                        'deliveryDetails' => $this->deliveryDetails, // Add this line
                        'order_description' => $this->order_description, // Add this line

                    ])
                    ->cc($this->ccEmails); // Use cc to set CC recipients


    }
}
