from __future__ import annotations

def evaluate(c):
    required=["site_ref","rest_api_version","credential_scope","order_id","wc_status","mapping_version","webhook_id","webhook_topic","signature_check","payload_digest","delivery_attempt","extension_assumption","reconciliation_state","evidence_ref"]
    if any(c.get(k) in (None,"","UNKNOWN") for k in required):
        if c.get("credential_scope") in (None,"","UNKNOWN"): return "HOLD_CREDENTIAL_SCOPE"
        return "HOLD_EVIDENCE"
    if c.get("rest_api_version") != "wc/v3": return "HOLD_REST_SURFACE"
    if c.get("requires_write") and c.get("credential_scope") not in ("write","read_write"): return "HOLD_CREDENTIAL_SCOPE"
    if c.get("signature_check") != "VERIFIED": return "HOLD_WEBHOOK_SIGNATURE"
    if c.get("is_custom_status") and not c.get("mapping_version_changed"): return "HOLD_MAPPING_VERSION"
    if c.get("assumption_site_ref") and c.get("assumption_site_ref") != c.get("site_ref"): return "HOLD_EXTENSION_SCOPE"
    if int(c.get("delivery_attempt",1)) > 1 and c.get("duplicate_effect_applied"): return "HOLD_RECONCILIATION"
    if c.get("reconciliation_state") in ("PENDING","UNKNOWN","FAILED","DUPLICATE_EFFECT_DETECTED"): return "HOLD_RECONCILIATION"
    return "ACCEPT_CONNECTOR"
