<?php

namespace App\Mail;

use App\Models\Subscription;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SubscriptionReminderMail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        public Subscription $subscription,
        public string $hotelName,
        public string $kind,
        public int $daysRemaining,
        public string $dueDate
    ) {
    }

    public function build()
    {
        $subject = $this->kind === 'overdue'
            ? "Subscription overdue for {$this->hotelName}"
            : "Subscription reminder for {$this->hotelName}";

        return $this->subject($subject)
            ->view('emails.subscription-reminder')
            ->with([
                'subscription' => $this->subscription,
                'hotelName' => $this->hotelName,
                'kind' => $this->kind,
                'daysRemaining' => $this->daysRemaining,
                'dueDate' => $this->dueDate,
            ]);
    }
}
