<?php

namespace App\Mail;

use App\Models\Lead;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class NovoLeadMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(public Lead $lead) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Novo lead: {$this->lead->name}" . ($this->lead->company ? " ({$this->lead->company})" : ''),
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'mail.novo-lead',
        );
    }
}
