namespace Apollinare.Domain.Entities.Warehouse;

/// <summary>
/// Riga dettaglio movimento di magazzino
/// </summary>
public class StockMovementLine : BaseEntity
{
    /// <summary>
    /// Movimento padre
    /// </summary>
    public int MovementId { get; set; }

    /// <summary>
    /// Numero riga
    /// </summary>
    public int LineNumber { get; set; }

    /// <summary>
    /// Articolo
    /// </summary>
    public int ArticleId { get; set; }

    /// <summary>
    /// Partita (se gestito a lotti)
    /// </summary>
    public int? BatchId { get; set; }

    /// <summary>
    /// Seriale (se gestito a seriali) - per movimenti di singoli pezzi
    /// </summary>
    public int? SerialId { get; set; }

    /// <summary>
    /// Quantità movimentata
    /// </summary>
    public decimal Quantity { get; set; }

    /// <summary>
    /// Unità di misura
    /// </summary>
    public string UnitOfMeasure { get; set; } = "PZ";

    /// <summary>
    /// Costo unitario (per valorizzazione)
    /// </summary>
    public decimal? UnitCost { get; set; }

    /// <summary>
    /// Valore totale riga
    /// </summary>
    public decimal? LineValue { get; set; }

    /// <summary>
    /// Ubicazione origine (per prelievi specifici)
    /// </summary>
    public string? SourceLocationCode { get; set; }

    /// <summary>
    /// Ubicazione destinazione (per posizionamenti specifici)
    /// </summary>
    public string? DestinationLocationCode { get; set; }

    /// <summary>
    /// Riferimento riga documento esterno
    /// </summary>
    public string? ExternalLineReference { get; set; }

    /// <summary>
    /// Note riga
    /// </summary>
    public string? Notes { get; set; }

    // Navigation properties
    public StockMovement? Movement { get; set; }
    public WarehouseArticle? Article { get; set; }
    public ArticleBatch? Batch { get; set; }
    public ArticleSerial? Serial { get; set; }
}
