using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Data.SeaHavenIndustries.Enums;
namespace Data.SeaHavenIndustries
{
public class WorkOrder : FullAuditEntity
{
// --- Core slice ---
public string? InternalWONumber { get; set; }
public string? ExternalWorkOrderId { get; set; }
public string? WorkerOrderNumber { get; set; }
public string? WorkerOrderTitle { get; set; }
public string? Description { get; set; }
public string? Customer { get; set; }
public string? SiteCode { get; set; }
public string? Building { get; set; }
public string? Severity { get; set; }
public DateTime? DueDate { get; set; }
public string? AssignTo { get; set; }
[ForeignKey(nameof(AssignTo))]
public virtual ApplicationUser? AssignToUser { get; set; }
public int? LocationId { get; set; }
[ForeignKey(nameof(LocationId))]
public virtual Locations? Locations { get; set; }
public LifecycleStatus? LifecycleStatus { get; set; }
public string? LegacyStatus { get; set; }
public WorkOrderType? WorkOrderType { get; set; }
/// SHOC board "Service" column (PM type label). Not Trade/Problem.
public string? Service { get; set; }
public int? PrimaryDispatchId { get; set; }
[ForeignKey(nameof(PrimaryDispatchId))]
public virtual Dispatch? PrimaryDispatch { get; set; }
// --- Scheduling slice ---
public DateTime? ScheduledDate { get; set; }
public DateTime? ScheduledStart { get; set; }
public DateTime? ScheduledEnd { get; set; }
public DateOnly? TargetWeek { get; set; }
public bool? ScheduleWeekOnly { get; set; }
// --- Tracking slice (set-once) ---
public DateOnly? OriginalWeek { get; set; }
public DateOnly? OriginalDate { get; set; }
// --- Analytics slice ---
public int RescheduleCount { get; set; }
public int CarriedOver { get; set; }
public OperationalFlags OperationalFlags { get; set; }
// --- Completion slice ---
public DocStatus? DocStatus { get; set; }
// --- Legacy SQL columns (drift reconciliation) ---
public string? AvettaTask { get; set; }
public DateOnly? AssignDate { get; set; }
// --- Legacy fields (retained for Blazor / coexistence) ---
public DateTime? DateReported { get; set; }
public string? SourceEmailS3Key { get; set; }
public string? Problem { get; set; }
public string? Trade { get; set; }
public string? SubTrade { get; set; }
public decimal? VendorNTE { get; set; }
public DateTime? CompletedDate { get; set; }
public string? Source { get; set; }
public bool? istemplate { get; set; }
public string? PO { get; set; }
public string? TT { get; set; }
public string? Priority { get; set; }
public string? Status { get; set; }
public string? Attachments { get; set; }
public string? BeforPhotoIssue { get; set; }
public string? BeforPhotoAttachment { get; set; }
public string? AfterPhotoIssue { get; set; }
public string? AfterPhotoAttachment { get; set; }
public string? SignOffName { get; set; }
public string? SignOffAttachment { get; set; }
public string? SignOffSignature { get; set; }
[Timestamp]
public byte[]? RowVersion { get; set; }
public ICollection? Comments { get; set; }
public ICollection? Quotes { get; set; }
public ICollection? WorkOrderContacts { get; set; }
public ICollection? workOrderAttachments { get; set; }
public ICollection? WorkOrderCategories { get; set; }
public ICollection? Dispatches { get; set; }
public ICollection? FieldLocks { get; set; }
}
}