<?php

declare(strict_types=1);

namespace App\Mail;

use App\Domain\Ssl\Models\SslCertificate;
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 SslExpiredMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(
        public readonly SslCertificate $certificate,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'SSL Sertifikanızın Süresi Doldu — '.$this->certificate->common_name,
            tags: ['ssl', 'expired'],
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.ssl.expired',
            with: ['certificate' => $this->certificate],
        );
    }
}
