public class ClinicalSyncBatch
{
    public Guid Id { get; private set; }
    public Guid GatewayId { get; private set; }
    public Guid SiteId { get; private set; }
    public Guid BatchReference { get; private set; }
    public ClinicalSyncBatchStatus Status { get; private set; } = ClinicalSyncBatchStatus.Received;
    public string Payload { get; private set; } = "{}";
    public DateTimeOffset SubmittedAt { get; private set; }
    public DateTimeOffset? ProcessedAt { get; private set; }

    public WardGateway Gateway { get; private set; } = null!;
    public ICollection<ClinicalSyncConflict> Conflicts { get; private set; } = [];

    private ClinicalSyncBatch() { }

    public ClinicalSyncBatch(Guid gatewayId, Guid siteId, Guid batchReference, string payload)
    {
        GatewayId = gatewayId;
        SiteId = siteId;
        BatchReference = batchReference;
        Payload = payload;
        SubmittedAt = DateTimeOffset.UtcNow;
    }

    public void MarkProcessing() => Status = ClinicalSyncBatchStatus.Processing;
    public void MarkApplied() { Status = ClinicalSyncBatchStatus.Applied; ProcessedAt = DateTimeOffset.UtcNow; }
    public void MarkConflict() { Status = ClinicalSyncBatchStatus.Conflict; ProcessedAt = DateTimeOffset.UtcNow; }
    public void MarkRejected() { Status = ClinicalSyncBatchStatus.Rejected; ProcessedAt = DateTimeOffset.UtcNow; }
}