<?php

namespace App\Support;

use App\Models\Booking;
use Illuminate\Support\Str;

final class BookingNumber
{
    public const PREFIX = 'Ryl-';

    public function unique(): string
    {
        do {
            $number = self::PREFIX.strtoupper(Str::random(6));
        } while (Booking::query()->where('number', $number)->exists());

        return $number;
    }
}
