<?php

namespace App\Models;

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

class Passenger extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',
        'preferred_payment_method',
        'home_address',
        'work_address',
        'emergency_contact',
        'rating',
        'total_trips',
        'is_verified',
        'is_active',
    ];

    protected $casts = [
        'is_verified' => 'boolean',
        'is_active' => 'boolean',
        'rating' => 'decimal:2',
        'total_trips' => 'integer',
    ];

    /**
     * Get the user that owns the passenger profile.
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    /**
     * Get the trips for this passenger.
     */
    public function trips()
    {
        return $this->hasMany(Trip::class, 'passenger_id');
    }

    /**
     * Get the payments for this passenger.
     */
    public function payments()
    {
        return $this->hasMany(Payment::class, 'passenger_id');
    }
}
