2026-07-27 14:40:17 -03:00
|
|
|
using Data.SeaHavenIndustries.Enums;
|
|
|
|
|
|
2026-07-24 21:03:50 -03:00
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
|
|
|
{
|
|
|
|
|
public interface IWorkOrderWebhookDataService
|
|
|
|
|
{
|
|
|
|
|
Task<WorkOrderWebhookPersistenceResult> ApplyAsync(
|
|
|
|
|
WorkOrderWebhookMutation mutation,
|
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sealed record WorkOrderWebhookMutation
|
|
|
|
|
{
|
|
|
|
|
public required string DeliveryId { get; init; }
|
|
|
|
|
public required string EventType { get; init; }
|
|
|
|
|
public required DateTimeOffset OccurredAt { get; init; }
|
|
|
|
|
public required DateTimeOffset ProcessedAt { get; init; }
|
|
|
|
|
public required string BodySha256 { get; init; }
|
|
|
|
|
public required string ExternalWorkOrderId { get; init; }
|
|
|
|
|
public required string WorkerOrderNumber { get; init; }
|
|
|
|
|
public required string Source { get; init; }
|
2026-07-24 22:13:25 -03:00
|
|
|
public required DateTimeOffset UpdatedAt { get; init; }
|
|
|
|
|
public required string VersionHash { get; init; }
|
2026-07-24 21:03:50 -03:00
|
|
|
public bool IsStateEvent { get; init; }
|
|
|
|
|
public bool IsCancelled { get; init; }
|
|
|
|
|
public string? Title { get; init; }
|
|
|
|
|
public string? Description { get; init; }
|
|
|
|
|
public string? Status { get; init; }
|
2026-07-27 14:40:17 -03:00
|
|
|
public LifecycleStatus? LifecycleStatus { get; init; }
|
2026-07-24 21:03:50 -03:00
|
|
|
public string? Severity { get; init; }
|
|
|
|
|
public string? Priority { get; init; }
|
2026-07-24 22:13:25 -03:00
|
|
|
public string? AssignedTo { get; init; }
|
|
|
|
|
public string? RecordType { get; init; }
|
|
|
|
|
public string? SourceEmailS3Key { get; init; }
|
2026-07-24 21:03:50 -03:00
|
|
|
public string? Customer { get; init; }
|
|
|
|
|
public string? SiteCode { get; init; }
|
|
|
|
|
public string? Building { get; init; }
|
|
|
|
|
public string? Address { get; init; }
|
|
|
|
|
public DateTime? DueDate { get; init; }
|
|
|
|
|
public DateTime? DateReported { get; init; }
|
|
|
|
|
public DateTime? ScheduledStart { get; init; }
|
|
|
|
|
public DateTime? CreatedAt { get; init; }
|
|
|
|
|
public string? CommentId { get; init; }
|
|
|
|
|
public string? CommentText { get; init; }
|
|
|
|
|
public string? Commenter { get; init; }
|
|
|
|
|
public string? CommentType { get; init; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum WorkOrderWebhookPersistenceStatus
|
|
|
|
|
{
|
|
|
|
|
Applied,
|
|
|
|
|
Duplicate,
|
2026-08-11 10:45:37 -03:00
|
|
|
HashConflict,
|
|
|
|
|
AccountUnresolved
|
2026-07-24 21:03:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sealed record WorkOrderWebhookPersistenceResult(
|
|
|
|
|
WorkOrderWebhookPersistenceStatus Status,
|
|
|
|
|
bool StateMutationSkipped = false);
|
|
|
|
|
}
|