<?php

namespace App\Mail;

use App\Models\User;
use App\Services\PlanFeatures;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;

final class PaymentFailedDay3Reminder extends Mailable
{
    public function __construct(public readonly User $user) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Heads up — your FuelAlert payment is retrying',
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'emails.payment-failed-day-3',
            with: [
                'name' => $this->user->name,
                'tier' => PlanFeatures::for($this->user)->tier(),
                'portalUrl' => route('billing.portal'),
            ],
        );
    }
}
