<?php

namespace App\Models;

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

class VehicleDataSource extends Model
{
    protected $fillable = [
        'vehicle_record_id',
        'source_name',
        'source_url',
        'last_fetched_at',
        'cache_expires_at',
    ];

    protected function casts(): array
    {
        return [
            'last_fetched_at' => 'datetime',
            'cache_expires_at' => 'datetime',
        ];
    }

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