<?php

namespace App\Models;

use App\Enums\JourneyMethod;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class TravelJourney extends Model
{
    /** @use HasFactory<\Database\Factories\TravelJourneyFactory> */
    use HasFactory;

    protected $fillable = [
        'travel_request_id',
        'origin',
        'destination',
        'date',
        'time',
        'method',
    ];

    protected function casts(): array
    {
        return [
            'method' => JourneyMethod::class,
            'date' => 'date',
        ];
    }

    public function travelRequest(): BelongsTo
    {
        return $this->belongsTo(TravelRequest::class);
    }
}
