{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openpalliative.github.io/pal-norms/data/v1/escalation.schema.json",
  "title": "Куда обращаться дальше",
  "type": "object",
  "required": [
    "dataset",
    "items"
  ],
  "properties": {
    "dataset": {
      "const": "escalation"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "verified",
          "verified_at",
          "source_ref",
          "order",
          "trigger",
          "title",
          "what",
          "addressee_kind",
          "parallel",
          "norm_ids",
          "quote_ids",
          "rule_ids",
          "ok_doc",
          "legal_review"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "x-message-ru": "дата в виде ГГГГ-ММ-ДД или пусто"
          },
          "source_ref": {
            "type": "string",
            "minLength": 1
          },
          "order": {
            "type": "integer",
            "minimum": 1
          },
          "trigger": {
            "enum": [
              "no_answer_after_due",
              "redirected_to_accused",
              "answer_not_on_merits",
              "threat_to_life"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "what": {
            "type": "string",
            "minLength": 1
          },
          "addressee_kind": {
            "enum": [
              "prosecutor",
              "rzn_territorial",
              "rzn_central",
              "health_authority",
              "head_of_organization"
            ]
          },
          "parallel": {
            "type": "boolean"
          },
          "norm_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            },
            "minItems": 1
          },
          "quote_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          "rule_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          "ok_doc": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
          },
          "legal_review": {
            "type": "object",
            "required": [
              "status"
            ],
            "additionalProperties": false,
            "properties": {
              "status": {
                "enum": [
                  "none",
                  "ok",
                  "expired"
                ]
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reviewed_at": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "x-message-ru": "дата в виде ГГГГ-ММ-ДД или пусто"
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "x-message-ru": "дата в виде ГГГГ-ММ-ДД или пусто"
              },
              "ref": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "interpretation": {
            "type": "boolean",
            "description": "адресат ступени выведен проектом, а не назван в цитате"
          },
          "interpretation_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "addressee_quote_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
