<?php

namespace App\Models;

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

class LoanApprovalDecision extends Model
{
    protected $fillable = [
        'loan_id','decision','previous_status','new_status','comments','user_id','is_auto','decided_at',
    ];

    protected function casts(): array
    {
        return ['is_auto'=>'boolean','decided_at'=>'datetime'];
    }

    public function loan(): BelongsTo { return $this->belongsTo(Loan::class); }
    public function user(): BelongsTo { return $this->belongsTo(User::class); }
}
