<?php

namespace App\Models;

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

class LoanLine extends Model
{
    use HasFactory;

    protected $fillable = [
        'loan_id',
        'item_id',
        'asset_unit_id',
        'item_name_snapshot',
        'quantity',
        'returned_quantity',
        'condition_on_loan',
        'condition_on_return',
        'notes',
    ];

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

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

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