<?php

namespace Kylin\Logistics\Models;

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

/**
 * GPS 轨迹模型
 *
 * 存储车辆每日 GPS 轨迹数据，按日期聚合。
 *
 * @property string $track_date  轨迹日期
 * @property string $track_data  轨迹数据（JSON）
 */
class GpsTrack extends Model
{
    public $timestamps = false;

    protected $table = 'kylin_log_gps_tracks';

    protected $fillable = [
        'vehicle_id', 'track_date', 'track_data',
    ];

    protected $casts = [
        'track_date' => 'date',
        'track_data' => 'json',
    ];

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