<?php

declare(strict_types=1);

namespace App\Mail;

use App\Models\Booking;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;

class BookingReleasedMail extends Mailable implements ShouldQueue
{
    use Queueable;

    public function __construct(public Booking $booking) {}

    public function envelope(): Envelope
    {
        return new Envelope(subject: 'Your session was released');
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'mail.booking-released',
            with: [
                'booking' => $this->booking,
                'startsAt' => $this->booking->starts_at->setTimezone(config('studio.timezone')),
                'bookAgainUrl' => route('book'),
            ],
        );
    }
}
