<?php

namespace App\Models;

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

/**
 * Línea de un documento de transferencia / salida agregada (ADR-002).
 */
class InventoryTransferLine extends Model
{
    protected $table = 'inventory_transfer_lines';

    protected $fillable = [
        'inventory_transfer_document_id',
        'inventory_product_id',
        'quantity',
        'sort_order',
    ];

    protected $casts = [
        'quantity' => 'string',
        'sort_order' => 'integer',
    ];

    public function document(): BelongsTo
    {
        return $this->belongsTo(InventoryTransferDocument::class, 'inventory_transfer_document_id');
    }

    public function inventoryProduct(): BelongsTo
    {
        return $this->belongsTo(InventoryProduct::class, 'inventory_product_id');
    }
}
