using Extrudex.Domain.Base; namespace Extrudex.Domain.Entities; /// /// Represents a physical spool of filament. Every spool must have a MaterialBase /// and MaterialFinish. MaterialModifier is optional. /// Spools are the core inventory unit and link to PrintJobs for COGS tracking. /// public class Spool : AuditableEntity { /// /// Foreign key to the base material. Every spool must specify a material base. /// public Guid MaterialBaseId { get; set; } /// /// Navigation to the base material (e.g., PLA, PETG, ABS). /// public MaterialBase MaterialBase { get; set; } = null!; /// /// Foreign key to the material finish. REQUIRED on every spool — default is "Basic". /// public Guid MaterialFinishId { get; set; } /// /// Navigation to the material finish (e.g., Basic, Matte, Silk, Glitter). /// public MaterialFinish MaterialFinish { get; set; } = null!; /// /// Foreign key to the optional material modifier. Null if no modifier applies. /// public Guid? MaterialModifierId { get; set; } /// /// Navigation to the optional material modifier (e.g., Carbon Fiber, Wood Fill). /// public MaterialModifier? MaterialModifier { get; set; } /// /// Human-readable brand name (e.g., "Bambu Lab", "Polymaker", "eSUN"). /// public string Brand { get; set; } = string.Empty; /// /// Human-readable color name (e.g., "Fire Engine Red", "Galaxy Black"). /// public string ColorName { get; set; } = string.Empty; /// /// Hex color code for the filament (e.g., "#FF0000" for red). /// Enables color-based filtering and visual identification. /// public string ColorHex { get; set; } = string.Empty; /// /// Total spool weight in grams when full (brand new, unopened). /// public decimal WeightTotalGrams { get; set; } /// /// Current remaining weight in grams. Updated via AMS data or manual check-in. /// public decimal WeightRemainingGrams { get; set; } /// /// Filament diameter in millimeters. Typically 1.75mm for FDM printers. /// Used in the COGS derivation formula: grams = mm × cross_section_area × density. /// public decimal FilamentDiameterMm { get; set; } = 1.75m; /// /// Manufacturer-assigned serial number for the spool. Used for barcode/QR scanning. /// Must be unique across all spools. /// public string SpoolSerial { get; set; } = string.Empty; /// /// Purchase price per spool in the system currency. Used for COGS calculations. /// public decimal? PurchasePrice { get; set; } /// /// Date the spool was purchased or received. /// public DateTime? PurchaseDate { get; set; } /// /// Whether the spool is currently active and available for use. /// Inactive spools are retained for historical COGS records. /// public bool IsActive { get; set; } = true; /// /// Navigation collection of AMS slots where this spool is loaded. /// public ICollection AmsSlots { get; set; } = new List(); /// /// Navigation collection of print jobs that consumed filament from this spool. /// public ICollection PrintJobs { get; set; } = new List(); }