using System.Collections.Generic;

namespace PowderCoating.Core.Entities
{
    /// <summary>
    /// Represents a hierarchical category in the product catalog.
    /// Supports multi-level nesting for organizing catalog items.
    /// </summary>
    public class CatalogCategory : BaseEntity
    {
        /// <summary>
        /// Gets or sets the category name.
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// Gets or sets the optional category description.
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// Gets or sets the parent category ID for hierarchical organization.
        /// Null indicates this is a root-level category.
        /// </summary>
        public int? ParentCategoryId { get; set; }

        /// <summary>
        /// Gets or sets the parent category navigation property.
        /// </summary>
        public virtual CatalogCategory? ParentCategory { get; set; }

        /// <summary>
        /// Gets or sets the collection of child categories.
        /// </summary>
        public virtual ICollection<CatalogCategory> SubCategories { get; set; } = new List<CatalogCategory>();

        /// <summary>
        /// Gets or sets the display order for sorting categories at the same level.
        /// Lower numbers appear first.
        /// </summary>
        public int DisplayOrder { get; set; }

        /// <summary>
        /// Gets or sets whether this category is currently active and visible.
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// When true, items in this category are retail merchandise available for direct sale
        /// (e.g. branded apparel, cleaning products). New items inherit this flag.
        /// </summary>
        public bool IsMerchandise { get; set; } = false;

        /// <summary>
        /// Gets or sets the collection of catalog items in this category.
        /// </summary>
        public virtual ICollection<CatalogItem> Items { get; set; } = new List<CatalogItem>();
    }
}
