namespace Kbx.Shared.Runtime;

public static class KbxOperationPolicy
{
    public static bool IsTerminal(string status) => status is "completed" or "partially-completed" or "failed" or "cancelled";

    public static bool CanRetryTransport(string httpMethod, bool hasIdempotencyKey)
    {
        if (httpMethod is "GET" or "HEAD") return true;
        return hasIdempotencyKey;
    }

    public static bool CanStartCommit(string currentStatus) => currentStatus is "validated" or "retryable";
}
