<?php

namespace App\Mail;

use App\Models\User;
use App\Models\Voucher;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SendVoucherMail extends Mailable
{
    use Queueable, SerializesModels;

    public $user;
    public $voucher;
    public $customMessage;

    /**
     * Create a new message instance.
     */
    public function __construct(User $user, Voucher $voucher, $customMessage = null)
    {
        $this->user = $user;
        $this->voucher = $voucher;
        $this->customMessage = $customMessage;
    }

    /**
     * Build the message.
     */
    public function build()
    {
        return $this->subject('Special Offer: You have received a new Voucher!')
                    ->view('emails.send_voucher');
    }
}
