namespace PowderCoating.Core.Entities;
///
/// Represents a single coating layer applied to a quote item.
/// Supports multi-coat configurations (primer, base coat, top coat, clear coat, etc.)
///
public class QuoteItemCoat : BaseEntity
{
// Parent relationship
public int QuoteItemId { get; set; }
// Coat identification (user-defined)
public string CoatName { get; set; } = string.Empty; // "Primer", "Base Coat", "Top Coat", etc.
public int Sequence { get; set; } // 1, 2, 3... for ordering
// Powder selection (same pattern as current QuoteItem)
public int? InventoryItemId { get; set; } // In-stock powder
///
/// Platform powder catalog item that this coat was sourced from.
/// Persisted so that at quote-approval time the system can create exactly one
/// IsIncoming InventoryItem per unique catalog powder (deduplication), rather
/// than creating during quote-save when the job may never be approved.
///
public int? PowderCatalogItemId { get; set; }
public string? ColorName { get; set; } // Color name
public int? VendorId { get; set; } // Vendor for custom powder
public string? ColorCode { get; set; } // RAL code, etc.
public string? Finish { get; set; } // Gloss, Matte, Textured, etc.
// Coverage parameters (defaults from inventory or user-specified)
public decimal CoverageSqFtPerLb { get; set; } = 30m;
public decimal TransferEfficiency { get; set; } = 65m;
// Cost override for custom powder
public decimal? PowderCostPerLb { get; set; } // $/lb for custom orders
public decimal? PowderToOrder { get; set; } // Pounds to order (rounded up from needed)
// Calculated costs (stored for audit trail)
public decimal CoatMaterialCost { get; set; }
public decimal CoatLaborCost { get; set; }
public decimal CoatTotalCost { get; set; }
// Pricing flags
///
/// When true, the additional layer labor charge is not applied for this coat even if it is
/// not the first coat in the sequence. Used for clear coats, sealers, etc.
///
public bool NoExtraLayerCharge { get; set; }
// Notes
public string? Notes { get; set; }
// Navigation properties
public virtual QuoteItem QuoteItem { get; set; } = null!;
public virtual InventoryItem? InventoryItem { get; set; }
public virtual Vendor? Vendor { get; set; }
}