using Extrudex.Domain.Base;

namespace Extrudex.Domain.Entities;

/// <summary>
/// Represents a single slot within an AMS unit. Each slot can hold one spool
/// and tracks the tray index, remaining weight, and which spool is loaded.
/// </summary>
public class AmsSlot : AuditableEntity
{
    /// <summary>
    /// The 1-based tray/slot index within the AMS unit (1-4 per unit).
    /// </summary>
    public int TrayIndex { get; set; }

    /// <summary>
    /// Foreign key to the AMS unit this slot belongs to.
    /// </summary>
    public Guid AmsUnitId { get; set; }

    /// <summary>
    /// Navigation to the parent AMS unit.
    /// </summary>
    public AmsUnit AmsUnit { get; set; } = null!;

    /// <summary>
    /// Foreign key to the spool currently loaded in this slot. Null if empty.
    /// </summary>
    public Guid? SpoolId { get; set; }

    /// <summary>
    /// Navigation to the spool currently loaded in this slot. Null if no spool is loaded.
    /// </summary>
    public Spool? Spool { get; set; }

    /// <summary>
    /// Remaining filament weight in grams as reported by the AMS.
    /// Bambu Lab AMS reports remaining weight per tray.
    /// </summary>
    public decimal? RemainingWeightG { get; set; }
}