{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/4chems-com/json-schema/4chems-com-routing-out-schema.json",
  "title": "RoutingOut",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/4chems-com-onboarding-api-openapi.yml#/components/schemas/RoutingOut",
  "properties": {
    "action": {
      "type": "string",
      "title": "Action",
      "x-extensible-enum": [
        "wizard",
        "wizard_no_tenant_domain",
        "request_access",
        "trial_used",
        "member",
        "register"
      ]
    },
    "next_step": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/NextStepOut"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Step"
    },
    "tenant_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tenant Name"
    },
    "registration_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Registration Url"
    },
    "registration_methods": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Registration Methods"
    },
    "subscription": {
      "anyOf": [
        {
          "$ref": "#/$defs/SubscriptionOut"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "action"
  ],
  "$defs": {
    "NextStepOut": {
      "properties": {
        "operation": {
          "type": "string",
          "title": "Operation"
        },
        "documents": {
          "items": {
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "object"
          },
          "type": "array",
          "title": "Documents"
        }
      },
      "type": "object",
      "required": [
        "operation",
        "documents"
      ],
      "title": "NextStepOut",
      "description": "What a `member` must do next: record consents to the listed documents (UC-093)."
    },
    "SubscriptionOut": {
      "properties": {
        "state": {
          "$ref": "#/$defs/SubscriptionState"
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At"
        },
        "grace_ends_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grace Ends At"
        }
      },
      "type": "object",
      "required": [
        "state",
        "expires_at",
        "grace_ends_at"
      ],
      "title": "SubscriptionOut"
    },
    "SubscriptionState": {
      "type": "string",
      "enum": [
        "trialing",
        "expired",
        "erased",
        "active"
      ],
      "title": "SubscriptionState",
      "description": "Commercial state (UC-096, UC-086 D7); `TrialStatus` is provisioning only."
    }
  }
}