<?php

namespace App\Notifications;

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

class BookingOwnerCancelledNotification 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 — {$b->company->name}")
            ->view('emails.booking-card', [
                'booking' => $b,
                'tone' => 'danger',
                'badge' => 'Cancelación',
                'eyebrow' => $b->company->name,
                'title' => 'Una reserva fue cancelada',
                'intro' => 'Esta cita ya no está activa. Te dejamos el detalle para actualizar tu operación.',
                'actionLabel' => 'Ver reserva',
                'actionUrl' => route('tenant.bookings.show', $b),
                'secondaryUrl' => null,
            ]);
    }
}
