<?php

namespace App\Models;

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

class LoanWriteOffDocument extends Model
{
    protected $fillable = [
        'loan_write_off_id','document_type','original_name','file_path','mime_type','file_size','notes','uploaded_by',
    ];

    protected function casts(): array
    {
        return ['file_size'=>'integer'];
    }

    public function writeOff(): BelongsTo { return $this->belongsTo(LoanWriteOff::class, 'loan_write_off_id'); }
    public function uploader(): BelongsTo { return $this->belongsTo(User::class, 'uploaded_by'); }
}
