{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/gnosis-pay/main/json-schema/gnosis-pay-onboarding-status-schema.json",
  "title": "OnboardingStatus",
  "description": "Onboarding status tagged union (discriminated by `status`).",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gnosis-pay-openapi.json#/components/schemas/OnboardingStatus",
  "type": "object",
  "oneOf": [
    {
      "$ref": "#/$defs/OnboardingStatusActionAcceptTos"
    },
    {
      "$ref": "#/$defs/OnboardingStatusWaitingKycSetup"
    },
    {
      "$ref": "#/$defs/OnboardingStatusActionCompleteKyc"
    },
    {
      "$ref": "#/$defs/OnboardingStatusKycManualReview"
    },
    {
      "$ref": "#/$defs/OnboardingStatusActionKycResubmissionRequested"
    },
    {
      "$ref": "#/$defs/OnboardingStatusActionCompleteSof"
    },
    {
      "$ref": "#/$defs/OnboardingStatusActionCreateAccount"
    },
    {
      "$ref": "#/$defs/OnboardingStatusWaitingAccountSetup"
    },
    {
      "$ref": "#/$defs/OnboardingStatusActionVerifyPhone"
    },
    {
      "$ref": "#/$defs/OnboardingStatusRejected"
    },
    {
      "$ref": "#/$defs/OnboardingStatusCompleted"
    }
  ],
  "$defs": {
    "OnboardingSofQuestion": {
      "type": "object",
      "required": [
        "id",
        "question",
        "answers"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "question": {
          "type": "string"
        },
        "answers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "OnboardingStatusActionAcceptTos": {
      "type": "object",
      "required": [
        "status",
        "terms"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_accept_tos"
          ]
        },
        "terms": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UserTermsStatus"
          }
        }
      }
    },
    "OnboardingStatusActionCompleteKyc": {
      "type": "object",
      "required": [
        "status",
        "webSdkUrl",
        "mobileSdkToken"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_complete_kyc"
          ]
        },
        "webSdkUrl": {
          "type": "string"
        },
        "mobileSdkToken": {
          "type": "string"
        }
      }
    },
    "OnboardingStatusActionCompleteSof": {
      "type": "object",
      "required": [
        "status",
        "questions",
        "version"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_complete_sof"
          ]
        },
        "questions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OnboardingSofQuestion"
          }
        },
        "version": {
          "type": "number"
        }
      }
    },
    "OnboardingStatusActionCreateAccount": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_create_account"
          ]
        }
      }
    },
    "OnboardingStatusActionKycResubmissionRequested": {
      "type": "object",
      "required": [
        "status",
        "webSdkUrl",
        "mobileSdkToken",
        "comments"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_kyc_resubmission_requested"
          ]
        },
        "webSdkUrl": {
          "type": "string"
        },
        "mobileSdkToken": {
          "type": "string"
        },
        "comments": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "OnboardingStatusActionVerifyPhone": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "action_verify_phone"
          ]
        }
      }
    },
    "OnboardingStatusCompleted": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "completed"
          ]
        }
      }
    },
    "OnboardingStatusKycManualReview": {
      "type": "object",
      "required": [
        "status",
        "comments"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "kyc_manual_review"
          ]
        },
        "comments": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "OnboardingStatusRejected": {
      "type": "object",
      "required": [
        "status",
        "reason"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "rejected"
          ]
        },
        "reason": {
          "type": "string"
        },
        "rejectLabels": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "comments": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "OnboardingStatusWaitingAccountSetup": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "waiting_account_setup"
          ]
        }
      }
    },
    "OnboardingStatusWaitingKycSetup": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "waiting_kyc_setup"
          ]
        }
      }
    },
    "UserTermsStatus": {
      "type": "object",
      "required": [
        "type",
        "currentVersion",
        "name",
        "url",
        "accepted",
        "acceptedVersion",
        "acceptedAt"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "currentVersion": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "accepted": {
          "type": "boolean"
        },
        "acceptedVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "acceptedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}