<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Str;

class Reservation extends Model
{
    protected $fillable = [
        'reservation_slot_id', 'customer_name', 'customer_email',
        'customer_phone', 'notes', 'status', 'token',
    ];

    public function slot(): BelongsTo
    {
        return $this->belongsTo(ReservationSlot::class, 'reservation_slot_id');
    }

    public static function generateToken(): string
    {
        return Str::random(32);
    }
}
