{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/raiffeisen-ru/main/json-schema/raiffeisen-ru-code-schema.json",
  "title": "Code",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/raiffeisen-ru-adm-deposit-codes-openapi.yml#/components/schemas/Code",
  "type": "object",
  "required": [
    "id",
    "available",
    "createDate",
    "updateDate",
    "customer",
    "person"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Идентификатор кода"
    },
    "available": {
      "type": "boolean",
      "description": "Доступен ли код"
    },
    "createDate": {
      "type": "string",
      "format": "date-time",
      "description": "Дата создания записи"
    },
    "updateDate": {
      "type": "string",
      "format": "date-time",
      "description": "Дата последнего обновления"
    },
    "customer": {
      "$ref": "#/$defs/Customer"
    },
    "person": {
      "$ref": "#/$defs/Person"
    }
  },
  "$defs": {
    "Customer": {
      "type": "object",
      "required": [
        "cnum",
        "name",
        "inn"
      ],
      "properties": {
        "cnum": {
          "type": "string",
          "description": "Клиентский номер компании"
        },
        "name": {
          "type": "string",
          "description": "Наименование компании"
        },
        "inn": {
          "type": "string",
          "description": "ИНН компании",
          "pattern": "^[0-9]{10}$|^$"
        }
      }
    },
    "Person": {
      "type": "object",
      "required": [
        "surname",
        "name",
        "birthDate",
        "cnum"
      ],
      "properties": {
        "surname": {
          "type": "string",
          "description": "Фамилия"
        },
        "name": {
          "type": "string",
          "description": "Имя"
        },
        "patronymic": {
          "type": "string",
          "description": "Отчество"
        },
        "birthDate": {
          "type": "string",
          "format": "date",
          "description": "Дата рождения"
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "description": "Email плательщика"
        },
        "cnum": {
          "type": "string",
          "description": "Клиентский номер плательщика"
        }
      }
    }
  }
}