{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ostrov-center/json-schema/ostrov-center-submit-application-request-schema.json",
  "title": "SubmitApplicationRequest",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ostrov-center-openapi.yml#/components/schemas/SubmitApplicationRequest",
  "type": "object",
  "properties": {
    "catalogVersion": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000000000
    },
    "documentVersion": {
      "type": "string",
      "maxLength": 100
    },
    "contactProfile": {
      "$ref": "#/$defs/ContactProfile"
    },
    "requestKey": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:-]{16,120}$",
      "description": "Unique key for one intended write; reuse exactly after an uncertain result. Use a new key for changed input."
    },
    "userConfirmed": {
      "type": "boolean",
      "const": true,
      "description": "Set only after the person explicitly requests this action."
    },
    "consent": {
      "type": "boolean",
      "const": true,
      "description": "Consent to submit contact information for handling this request."
    }
  },
  "required": [
    "catalogVersion",
    "documentVersion",
    "contactProfile",
    "requestKey",
    "userConfirmed",
    "consent"
  ],
  "additionalProperties": false,
  "$defs": {
    "ContactProfile": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "phone": {
          "type": "string",
          "maxLength": 80
        },
        "email": {
          "type": "string",
          "maxLength": 254,
          "format": "email"
        },
        "notes": {
          "type": "string",
          "maxLength": 4000
        },
        "messengers": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "enum": [
                  "telegram",
                  "whatsapp",
                  "max"
                ]
              },
              "username": {
                "type": "string",
                "maxLength": 100
              },
              "userId": {
                "type": "string",
                "const": "",
                "description": "Typed contact is not authenticated identity; must be empty."
              }
            },
            "required": [
              "type",
              "username",
              "userId"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "name",
        "phone",
        "email",
        "notes",
        "messengers"
      ],
      "additionalProperties": false
    }
  }
}