namespace Apollinare.Domain.Entities.Warehouse;

/// <summary>
/// Categoria articoli magazzino con struttura gerarchica
/// </summary>
public class WarehouseArticleCategory : BaseEntity
{
    /// <summary>
    /// Codice categoria - generato automaticamente
    /// </summary>
    public string Code { get; set; } = string.Empty;

    /// <summary>
    /// Codice alternativo (opzionale, inserito dall'utente)
    /// </summary>
    public string? AlternativeCode { get; set; }

    /// <summary>
    /// Nome categoria
    /// </summary>
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// Descrizione
    /// </summary>
    public string? Description { get; set; }

    /// <summary>
    /// ID categoria padre (per gerarchia)
    /// </summary>
    public int? ParentCategoryId { get; set; }

    /// <summary>
    /// Livello nella gerarchia (0 = root)
    /// </summary>
    public int Level { get; set; }

    /// <summary>
    /// Path completo codici (es. "001.002.003")
    /// </summary>
    public string? FullPath { get; set; }

    /// <summary>
    /// Icona categoria (nome icona MUI)
    /// </summary>
    public string? Icon { get; set; }

    /// <summary>
    /// Colore categoria (hex)
    /// </summary>
    public string? Color { get; set; }

    /// <summary>
    /// Metodo di valorizzazione default per articoli di questa categoria
    /// </summary>
    public ValuationMethod? DefaultValuationMethod { get; set; }

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

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

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

    // Navigation properties
    public WarehouseArticleCategory? ParentCategory { get; set; }
    public ICollection<WarehouseArticleCategory> ChildCategories { get; set; } = new List<WarehouseArticleCategory>();
    public ICollection<WarehouseArticle> Articles { get; set; } = new List<WarehouseArticle>();
}
