<?php

namespace Modules\Lpj\Emails;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
// use Illuminate\Contracts\Queue\ShouldQueue;

class SendPenawaranKJPPEmail extends Mailable
{
    use Queueable, SerializesModels;

    // Tambahkan properti untuk data yang akan dikirimkan ke view
    public $dp1;
    public $penawaran;
    public $permohonan;
    public $villages;
    public $districts;
    public $cities;
    public $provinces;
    public $user; // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc

    /**
     * Create a new message instance.
     */
    public function __construct($dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces, $user)
    {
        // Assign data yang diterima ke properti
        $this->dp1 = $dp1;
        $this->penawaran = $penawaran;
        $this->permohonan = $permohonan;
        $this->villages = $villages;
        $this->districts = $districts;
        $this->cities = $cities;
        $this->provinces = $provinces;
        $this->user = $user; // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc
    }

    /**
     * Build the message.
     */
    public function build(): self
    {
        // Kirim data ke view
        return $this->view('lpj::penawaran.kirimEmailKJPP')
            ->with([
                'dp1' => $this->dp1,
                'penawaran' => $this->penawaran,
                'permohonan' => $this->permohonan,
                'villages' => $this->villages,
                'districts' => $this->districts,
                'cities' => $this->cities,
                'provinces' => $this->provinces,
                'user' => $this->user // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc
            ]);
    }
}
