{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fingertrackid.dev/schemas/customer-action-request.v1.schema.json",
  "title": "CustomerActionRequestV1",
  "$comment": "Generated from existing feedback OpenAPI components. Do not edit; regenerate locally. Generation does not establish validator parity, publication readiness, authentication or runtime availability.",
  "x-implementation-status": "generated-not-parity-validated",
  "x-ftid-generation": {
    "generator": "../../tools/generate-feedback-schemas.ts",
    "source_document": "../openapi/feedback.v1.yaml",
    "source_component": "#/components/schemas/CustomerActionRequestV1",
    "source_openapi_version": "3.1.0",
    "source_info_version": "1.0.0",
    "source_sha256": "a1ade5a3364cd6b940eee85f84e5426eac702c47b461118ee449735320ac0789"
  },
  "x-ftid-raw-input-profile": {
    "content_encoding": "FORBIDDEN_INCLUDING_IDENTITY",
    "content_type": "application/json",
    "encoding": "UTF-8_WITHOUT_BOM",
    "lossless_effect": "../canonicalization/feedback-effect-v1.md",
    "maximum_body_bytes": 16384,
    "numeric_confidence": "A number must equal the exact decimal value of its parsed binary64 Number's\nshortest roundtrip decimal spelling. Equivalent exponent/trailing-zero forms\nare allowed; silent rounding and underflow are rejected. Positive and negative\nzero are one semantic value. The effect uses binary64 big-endian hex, not a\nrounded SQL numeric projection.\n",
    "raw_parser": "../../packages/contracts/src/feedback-raw-input-v1.ts",
    "reject": [
      "DUPLICATE_DECODED_MEMBERS",
      "UNKNOWN_MEMBERS",
      "NESTED_VALUES",
      "NUL",
      "UNPAIRED_SURROGATES",
      "TRAILING_DOCUMENT"
    ],
    "request_target": "EXACT_ORIGIN_FORM_NO_QUERY_NO_NORMALIZATION",
    "root": "ONE_CLOSED_FLAT_OBJECT"
  },
  "$ref": "#/$defs/CustomerActionRequestV1",
  "$defs": {
    "CustomerActionRequestV1": {
      "additionalProperties": false,
      "allOf": [
        {
          "oneOf": [
            {
              "properties": {
                "basis": {
                  "const": "ASSESSMENT"
                },
                "reason_code": {
                  "const": "FOLLOWED_FTID_RECOMMENDATION"
                }
              }
            },
            {
              "properties": {
                "basis": {
                  "const": "CLIENT_POLICY"
                },
                "reason_code": {
                  "enum": ["CLIENT_POLICY_RULE", "EXTERNAL_FRAUD_CONTROL", "CUSTOMER_CANCELLED"]
                }
              }
            },
            {
              "properties": {
                "basis": {
                  "const": "FALLBACK"
                },
                "reason_code": {
                  "const": "CLIENT_FALLBACK_APPLIED"
                }
              }
            },
            {
              "properties": {
                "basis": {
                  "const": "MANUAL_REVIEW"
                },
                "reason_code": {
                  "enum": ["MANUAL_REVIEW_DECISION", "CUSTOMER_CANCELLED"]
                }
              }
            }
          ]
        },
        {
          "if": {
            "properties": {
              "reason_code": {
                "const": "CUSTOMER_CANCELLED"
              }
            }
          },
          "then": {
            "properties": {
              "action": {
                "const": "CANCELLED"
              }
            }
          }
        }
      ],
      "properties": {
        "action": {
          "enum": ["ALLOWED", "CHALLENGED", "HELD", "REVIEWED", "BLOCKED", "CANCELLED"]
        },
        "basis": {
          "enum": ["ASSESSMENT", "CLIENT_POLICY", "FALLBACK", "MANUAL_REVIEW"]
        },
        "external_action_id": {
          "$ref": "#/$defs/ExternalId"
        },
        "idempotency_key": {
          "$ref": "#/$defs/IdempotencyKey"
        },
        "occurred_at": {
          "$ref": "#/$defs/SourceInstant"
        },
        "reason_code": {
          "enum": [
            "FOLLOWED_FTID_RECOMMENDATION",
            "CLIENT_POLICY_RULE",
            "CLIENT_FALLBACK_APPLIED",
            "MANUAL_REVIEW_DECISION",
            "EXTERNAL_FRAUD_CONTROL",
            "CUSTOMER_CANCELLED"
          ]
        },
        "schema_version": {
          "const": "customer-action.v1"
        }
      },
      "required": [
        "schema_version",
        "external_action_id",
        "idempotency_key",
        "action",
        "basis",
        "occurred_at",
        "reason_code"
      ],
      "type": "object"
    },
    "ExternalId": {
      "description": "Opaque 1..255 UTF-16 code units, NOT Unicode code points. Supplementary\nscalars count as two units. Preserve whitespace and exact spelling; reject\nNUL and unpaired surrogates. maxLength alone is insufficient for this bound.\n",
      "maxLength": 255,
      "minLength": 1,
      "type": "string",
      "x-ftid-max-utf16-code-units": 255
    },
    "IdempotencyKey": {
      "maxLength": 255,
      "minLength": 8,
      "pattern": "^[\\x21-\\x7e]+$",
      "type": "string"
    },
    "SourceInstant": {
      "description": "Lossless existing Instante grammar; do not normalize, truncate or add a stricter RFC date-time format",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      "type": "string"
    }
  }
}
