<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class EsignOtpMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        public string $signerName,
        public string $otpCode,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            from: new Address(config('mail.contact_from_address', config('mail.from.address')), config('mail.from.name')),
            subject: '[SAM] 전자계약 인증 코드',
        );
    }

    public function content(): Content
    {
        return new Content(
            html: 'emails.esign.otp',
            with: [
                'signerName' => $this->signerName,
                'otpCode' => $this->otpCode,
            ],
        );
    }
}
