namespace SeaHaven.Services.DTOs { public enum VendorOperationOutcomeKind { Ok, NotFound, BadRequest, Conflict } public sealed class VendorOperationOutcome { public VendorOperationOutcomeKind Kind { get; init; } public T? Value { get; init; } public string? Message { get; init; } public static VendorOperationOutcome Ok(T value) => new() { Kind = VendorOperationOutcomeKind.Ok, Value = value }; public static VendorOperationOutcome NotFound(string? message = null) => new() { Kind = VendorOperationOutcomeKind.NotFound, Message = message }; public static VendorOperationOutcome BadRequest(string message) => new() { Kind = VendorOperationOutcomeKind.BadRequest, Message = message }; public static VendorOperationOutcome Conflict(string message) => new() { Kind = VendorOperationOutcomeKind.Conflict, Message = message }; } public abstract class VendorNotificationItem { public DateTime TriggeredAt { get; set; } } public sealed class NotificationActionDto { public string Label { get; set; } = ""; public string Href { get; set; } = ""; } public sealed class NoVendorNotification : VendorNotificationItem { public string Id { get; set; } = ""; public string Type { get; set; } = ""; public string Severity { get; set; } = ""; public string Group { get; set; } = ""; public string Title { get; set; } = ""; public int WorkOrderId { get; set; } public string? WorkOrderNumber { get; set; } public DateTime ScheduledAt { get; set; } public NotificationActionDto Action { get; set; } = new(); } public sealed class ConflictWorkOrderDto { public int WorkOrderId { get; set; } public string? WorkOrderNumber { get; set; } public DateTime Start { get; set; } public DateTime End { get; set; } } public sealed class VendorConflictNotification : VendorNotificationItem { public string Id { get; set; } = ""; public string Type { get; set; } = ""; public string Severity { get; set; } = ""; public string Group { get; set; } = ""; public string Title { get; set; } = ""; public int VendorId { get; set; } public string? VendorName { get; set; } public IReadOnlyList WorkOrders { get; set; } = Array.Empty(); public IReadOnlyList Actions { get; set; } = Array.Empty(); } public sealed class VendorNotificationsResult { public DateTime GeneratedAt { get; set; } public IReadOnlyList Items { get; set; } = Array.Empty(); } public sealed class AvailabilityConflictDto { public int? WorkOrderId { get; set; } public string? WorkOrderNumber { get; set; } public DateTime Start { get; set; } public DateTime End { get; set; } } public sealed class VendorAvailabilityRow { public int Id { get; set; } public string? CompanyName { get; set; } public string? ContactName { get; set; } public string? TradeSpecialties { get; set; } public string AvailabilityStatus { get; set; } = ""; public DateTime? AvailabilityUpdatedAt { get; set; } public bool IsPreferred { get; set; } public int? PreferenceRank { get; set; } public IReadOnlyList Conflicts { get; set; } = Array.Empty(); } public sealed class VendorAvailabilityResult { public DateTime GeneratedAt { get; set; } public int StaleAfterHours { get; set; } public IReadOnlyList Data { get; set; } = Array.Empty(); } public sealed class VendorAvailabilityUpdateResult { public int Id { get; set; } public string? AvailabilityStatus { get; set; } public DateTime? AvailabilityUpdatedAt { get; set; } } public sealed class SitePreferenceRow { public int Id { get; set; } public int LocationId { get; set; } public int VendorId { get; set; } public string? VendorName { get; set; } public string? Trade { get; set; } public int? SortOrder { get; set; } public bool IsStale { get; set; } public DateTime? LastModificationTime { get; set; } public string? UpdatedBy { get; set; } } public sealed class DocumentReviewResult { public int Id { get; set; } public string? ReviewStatus { get; set; } public string? RejectionReason { get; set; } public DateTime? ReviewedAt { get; set; } } public sealed class CommercialStatusResult { public int Id { get; set; } public string? PONumber { get; set; } public string? InvoiceNumber { get; set; } public string? InvoiceStatus { get; set; } public string? PaymentStatus { get; set; } public DateTime? CommercialStatusUpdatedAt { get; set; } } public sealed class VendorAssignmentResult { public int Id { get; set; } public int VendorId { get; set; } public string? VendorName { get; set; } public DateTime? EstimatedArrivalAt { get; set; } public bool EtaManualOverride { get; set; } public string AvailabilityStatus { get; set; } = ""; public IReadOnlyList Conflicts { get; set; } = Array.Empty(); } public sealed class VendorInsightRow { public int VendorId { get; set; } public string Vendor { get; set; } = ""; public int CompletedJobs { get; set; } public decimal CancellationRefusalRate { get; set; } public decimal OnTimeArrivalRate { get; set; } public decimal OnTimeCompletionRate { get; set; } public double? AverageCycleHours { get; set; } } }