using Extrudex.Domain.Base; using Extrudex.Domain.Enums; namespace Extrudex.Domain.Entities; /// /// Represents a single print job. Tracks which printer and spool were used, /// how much filament was consumed, and audit snapshots of material properties /// at the time of printing (to preserve COGS accuracy even if material data /// changes later). /// public class PrintJob : AuditableEntity { /// /// Foreign key to the printer that executed this print job. /// public Guid PrinterId { get; set; } /// /// Navigation to the printer that executed this print job. /// public Printer Printer { get; set; } = null!; /// /// Foreign key to the spool that provided filament for this print job. /// public Guid SpoolId { get; set; } /// /// Navigation to the spool that provided filament for this print job. /// public Spool Spool { get; set; } = null!; /// /// Human-readable name or identifier for the print job. /// public string PrintName { get; set; } = string.Empty; /// /// Path or filename of the G-code file being printed. /// public string? GcodeFilePath { get; set; } /// /// Total millimeters of filament extruded during this print job. /// The primary input to the COGS derivation formula. /// public decimal MmExtruded { get; set; } /// /// Derived grams consumed for this print, calculated as: /// mm_extruded × cross_section_area × material_density_at_print. /// public decimal GramsDerived { get; set; } /// /// Calculated cost of goods sold (COGS) for this print job. /// Derived from grams consumed and the spool's purchase price. /// public decimal? CostPerPrint { get; set; } /// /// Timestamp when the print job started (UTC). /// public DateTime? StartedAt { get; set; } /// /// Timestamp when the print job completed or failed (UTC). /// public DateTime? CompletedAt { get; set; } /// /// Current status of the print job. /// public JobStatus Status { get; set; } = JobStatus.Queued; /// /// The source of the print job data (which integration path provided it). /// public DataSource DataSource { get; set; } /// /// Audit snapshot: the filament diameter (mm) recorded at the time of printing. /// Preserved so COGS calculations remain accurate even if the spool's /// diameter is later corrected. /// public decimal FilamentDiameterAtPrintMm { get; set; } /// /// Audit snapshot: the material density (g/cm³) recorded at the time of printing. /// Preserved so COGS calculations remain accurate even if the material's /// density is later corrected. /// public decimal MaterialDensityAtPrint { get; set; } /// /// Optional notes about the print job (e.g., "First layer adhesion issues"). /// public string? Notes { get; set; } }