//
// Copyright (c) StellaOps. Licensed under AGPL-3.0-or-later.
//
namespace StellaOps.AirGap.Sync.Models;
///
/// Result of conflict resolution for a job ID.
///
public sealed record ConflictResolution
{
///
/// Gets the type of conflict detected.
///
public required ConflictType Type { get; init; }
///
/// Gets the resolution strategy applied.
///
public required ResolutionStrategy Resolution { get; init; }
///
/// Gets the selected entry (when resolution is not Error).
///
public OfflineJobLogEntry? SelectedEntry { get; init; }
///
/// Gets the entries that were dropped.
///
public IReadOnlyList? DroppedEntries { get; init; }
///
/// Gets the error message (when resolution is Error).
///
public string? Error { get; init; }
}
///
/// Types of conflicts that can occur during merge.
///
public enum ConflictType
{
///
/// Same JobId with different HLC timestamps but identical payload.
///
DuplicateTimestamp,
///
/// Same JobId with different payloads - indicates a bug.
///
PayloadMismatch
}
///
/// Strategies for resolving conflicts.
///
public enum ResolutionStrategy
{
///
/// Take the entry with the earliest HLC timestamp.
///
TakeEarliest,
///
/// Fail the merge - conflict cannot be resolved.
///
Error
}