namespace Apollinare.Domain.Entities.Warehouse;

/// <summary>
/// Causale movimento di magazzino
/// </summary>
public class MovementReason : BaseEntity
{
    /// <summary>
    /// Codice causale
    /// </summary>
    public string Code { get; set; } = string.Empty;

    /// <summary>
    /// Descrizione causale
    /// </summary>
    public string Description { get; set; } = string.Empty;

    /// <summary>
    /// Tipo movimento associato
    /// </summary>
    public MovementType MovementType { get; set; }

    /// <summary>
    /// Segno del movimento sulla giacenza (+1 carico, -1 scarico)
    /// </summary>
    public int StockSign { get; set; }

    /// <summary>
    /// Se true, richiede riferimento documento esterno
    /// </summary>
    public bool RequiresExternalReference { get; set; }

    /// <summary>
    /// Se true, richiede valorizzazione
    /// </summary>
    public bool RequiresValuation { get; set; } = true;

    /// <summary>
    /// Se true, aggiorna il costo medio
    /// </summary>
    public bool UpdatesAverageCost { get; set; } = true;

    /// <summary>
    /// Se true, è una causale di sistema (non modificabile)
    /// </summary>
    public bool IsSystem { get; set; }

    /// <summary>
    /// Se attiva
    /// </summary>
    public bool IsActive { get; set; } = true;

    /// <summary>
    /// Ordine visualizzazione
    /// </summary>
    public int SortOrder { get; set; }

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

    // Navigation properties
    public ICollection<StockMovement> Movements { get; set; } = new List<StockMovement>();
}
