<?php

namespace App\Notifications;

use App\Models\Booking;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class BookingCancelledNotification extends Notification
{
    use Queueable;

    public function __construct(public Booking $booking) {}

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        $b = $this->booking;

        return (new MailMessage)
            ->subject("Reserva {$b->code} cancelada")
            ->view('emails.booking-card', [
                'booking' => $b,
                'tone' => 'danger',
                'badge' => 'Reserva cancelada',
                'eyebrow' => 'Hola '.$b->customer->first_name,
                'title' => 'Tu reserva fue cancelada',
                'intro' => "La reserva en {$b->company->name} ya no está activa. Puedes crear una nueva cita cuando lo necesites.",
                'actionLabel' => 'Reservar de nuevo',
                'actionUrl' => url("/empresa/{$b->company->slug}"),
                'secondaryUrl' => null,
            ]);
    }
}
