<?php

declare(strict_types=1);

namespace App\Mail;

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;

/**
 * Phase 2 — e-Fatura entegrasyonu hazır olduğunda doldurulacak.
 * Şu an placeholder implementasyon.
 */
class InvoiceReadyMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(
        public readonly string $userName,
        public readonly string $invoiceNumber,
        public readonly string $amount,
        public readonly string $invoiceDate = '',
        public readonly string $dueDate = '',
        public readonly string $status = 'Ödeme Bekleniyor',
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Faturanız Hazır — {$this->invoiceNumber}",
            tags: ['billing', 'invoice'],
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.billing.invoice-ready',
            with: [
                'userName' => $this->userName,
                'invoiceNumber' => $this->invoiceNumber,
                'amount' => $this->amount,
                'invoiceDate' => $this->invoiceDate ?: now()->format('d.m.Y'),
                'dueDate' => $this->dueDate,
                'status' => $this->status,
            ],
        );
    }
}
