<?php

namespace App\Models;

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

class TransportRoute extends Model
{
    use HasFactory;

    protected $fillable = [
        'origin_city_id',
        'destination_city_id',
        'route_type_id',
        'distance_km',
        'is_active',
    ];

    protected $casts = [
        'distance_km' => 'decimal:2',
        'is_active' => 'boolean',
    ];

    public function originCity()
    {
        return $this->belongsTo(City::class, 'origin_city_id');
    }

    public function destinationCity()
    {
        return $this->belongsTo(City::class, 'destination_city_id');
    }

    public function routeType()
    {
        return $this->belongsTo(RouteType::class, 'route_type_id');
    }
}
