<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Depreciation extends Model
{
    protected $fillable = [
        'car_id',
        'depreciation_date',
        'amount',
        'book_value',
        'accumulated_depreciation',
        'mileage_at_period'
    ];

    protected $casts = [
        'depreciation_date' => 'date',
        'amount' => 'decimal:2',
        'book_value' => 'decimal:2',
        'accumulated_depreciation' => 'decimal:2',
    ];

    public function car()
    {
        return $this->belongsTo(Car::class);
    }
}
