using PowderCoating.Core.Enums; namespace PowderCoating.Core.Entities; public class Equipment : BaseEntity { public string EquipmentName { get; set; } = string.Empty; public string? EquipmentNumber { get; set; } public string EquipmentType { get; set; } = string.Empty; // Oven, Spray Booth, Compressor, etc. public string? Manufacturer { get; set; } public string? Model { get; set; } public string? SerialNumber { get; set; } public DateTime? PurchaseDate { get; set; } public decimal PurchasePrice { get; set; } public DateTime? WarrantyExpiration { get; set; } public EquipmentStatus Status { get; set; } = EquipmentStatus.Operational; public string? Location { get; set; } // Maintenance Information public int? RecommendedMaintenanceIntervalDays { get; set; } public DateTime? LastMaintenanceDate { get; set; } public DateTime? NextScheduledMaintenance { get; set; } public string? Notes { get; set; } public bool IsActive { get; set; } = true; // Oven-specific capacity (relevant when EquipmentType == "Oven") public decimal? MaxLoadSqFt { get; set; } public int? OvenCycleMinutes { get; set; } // User Manual public string? ManualFilePath { get; set; } // Filesystem path: /media/{CompanyId}/equipment-manuals/{equipmentId}/{filename}.pdf public string? ManualFileName { get; set; } // Original filename public long? ManualFileSize { get; set; } // File size in bytes public string? ManualContentType { get; set; } // e.g., "application/pdf" public DateTime? ManualUploadedDate { get; set; } // Relationships public virtual ICollection MaintenanceRecords { get; set; } = new List(); public virtual ICollection OvenBatches { get; set; } = new List(); } public class MaintenanceRecord : BaseEntity { public int EquipmentId { get; set; } public string MaintenanceType { get; set; } = string.Empty; // Preventive, Repair, Inspection, etc. public MaintenanceStatus Status { get; set; } = MaintenanceStatus.Scheduled; public MaintenancePriority Priority { get; set; } = MaintenancePriority.Normal; public DateTime ScheduledDate { get; set; } public DateTime? CompletedDate { get; set; } public string? PerformedById { get; set; } // Changed from int? to string? for Identity FK public string? AssignedUserId { get; set; } // Assigned user public string Description { get; set; } = string.Empty; public string? WorkPerformed { get; set; } public string? PartsReplaced { get; set; } public decimal LaborCost { get; set; } public decimal PartsCost { get; set; } public decimal TotalCost { get; set; } public decimal DowntimeHours { get; set; } public string? Notes { get; set; } public string? TechnicianNotes { get; set; } // Recurrence public bool IsRecurring { get; set; } public MaintenanceRecurrenceFrequency? RecurrenceFrequency { get; set; } public DateTime? RecurrenceEndDate { get; set; } public string? RecurrenceGroupId { get; set; } // GUID string groups all occurrences in a series public int? RecurrenceParentId { get; set; } // null on parent; child → parent.Id // Relationships public virtual Equipment Equipment { get; set; } = null!; public virtual ApplicationUser? PerformedBy { get; set; } public virtual ApplicationUser? AssignedUser { get; set; } public virtual MaintenanceRecord? RecurrenceParent { get; set; } }