<?php

namespace App\Models\Warehouse\FixedAssets;

use Illuminate\Database\Eloquent\Model;

class FixedAssetAllocationItem extends Model
{
    protected $table = 'fixed_asset_allocation_items';

    protected $fillable = [
        'fixed_asset_allocation_id',
        'fixed_asset_id',
        'condition_at_allocation',
        'is_allocated',
        'allocated_at',
        'notes',
    ];

    protected $casts = [
        'is_allocated' => 'boolean',
        'allocated_at' => 'datetime',
    ];

    // ── Relationships ──────────────────────────────────────────────────

    public function allocation()
    {
        return $this->belongsTo(FixedAssetAllocation::class, 'fixed_asset_allocation_id');
    }

    public function fixedAsset()
    {
        return $this->belongsTo(FixedAsset::class, 'fixed_asset_id');
    }
}
