<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class SeatBooking extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id', 'bus_schedule_id', 'seat_numbers', 'pickup_option', 
        'passenger_name', 'passenger_phone', 'next_of_kin_phone',
        'total_amount', 'status', 'ticket_qr_code'
    ];

    protected $casts = [
        'seat_numbers' => 'array'
    ];

    public function schedule()
    {
        return $this->belongsTo(BusSchedule::class, 'bus_schedule_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
