namespace DodoSSH.Contracts;

/// <summary>
/// Outcome of a single operation within a sync push.
/// </summary>
/// <remarks>
/// A push returns HTTP 200 even when some operations fail, with one of these per operation.
/// Conflicting operations are skipped rather than aborting the batch, so one stale item cannot
/// block every other change a client has queued while offline.
/// </remarks>
public enum SyncOperationStatus
{
    /// <summary>Not a legal value.</summary>
    Unspecified = 0,

    /// <summary>Applied. The response carries the new version and change sequence.</summary>
    Applied = 1,

    /// <summary>
    /// The expected version did not match. The response carries the server's current entity so
    /// the client can merge and re-push; the server never merges, because it cannot read the
    /// payload.
    /// </summary>
    Conflict = 2,

    /// <summary>The caller lacks permission for this entity.</summary>
    Forbidden = 3,

    /// <summary>Structurally invalid: unknown entity type, malformed envelope, missing field.</summary>
    Invalid = 4,

    /// <summary>
    /// This operation id was already applied. Retries are therefore exactly-once at operation
    /// granularity rather than merely at batch granularity.
    /// </summary>
    Duplicate = 5,
}
