<?php

namespace App\Jobs;

use App\Models\ContactLead;
use Illuminate\Support\Facades\Mail;

class SendLeadMails
{
    public $lead;

    public function __construct(ContactLead $lead)
    {
        $this->lead = $lead;
    }

    public function handle()
    {
        // Admin Mail
        Mail::send('emails.contact', ['lead' => $this->lead], function ($mail) {
            $mail->to('ourword@eggfirst.com')
                 ->cc('Shakib.r@eggfirst.com')
                   ->subject('New Lead Alert 🚀 | Eggfirst Contact Form');
        });

        // User Mail
        Mail::send('emails.user-confirmation', ['lead' => $this->lead], function ($mail) {
            $mail->to($this->lead->email)
                 ->subject('Thank you for contacting Eggfirst');
        });
    }
}
