<?php

namespace App\Notifications;

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

class BookingConfirmation 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} — {$b->company->name}")
            ->view('emails.booking-card', [
                'booking' => $b,
                'tone' => 'success',
                'badge' => 'Reserva confirmada',
                'eyebrow' => 'Hola '.$b->customer->first_name,
                'title' => 'Tu cita quedó agendada',
                'intro' => "Tu reserva en {$b->company->name} fue registrada correctamente. Te dejamos todos los detalles para que los tengas a mano.",
                'actionLabel' => 'Ver página del negocio',
                'actionUrl' => url("/empresa/{$b->company->slug}"),
                'secondaryUrl' => route('public.bookings.cancel.show', $b),
            ]);
    }
}
