{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openpalliative.github.io/pal-norms/data/v1/lint-rules.schema.json",
  "title": "Правила проверки текста",
  "type": "object",
  "required": [
    "dataset",
    "items"
  ],
  "properties": {
    "dataset": {
      "const": "lint-rules"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "verified",
          "verified_at",
          "source_ref",
          "kind",
          "patterns",
          "flags",
          "context",
          "act_id",
          "suggest_act_id",
          "message",
          "severity",
          "quote_ids",
          "since"
        ],
        "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
          },
          "kind": {
            "enum": [
              "repealed_act",
              "agency",
              "deadline_mismatch"
            ]
          },
          "patterns": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "flags": {
            "type": "string",
            "pattern": "^i?$"
          },
          "context": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "pattern",
              "window"
            ],
            "additionalProperties": false,
            "properties": {
              "pattern": {
                "type": "string",
                "minLength": 1
              },
              "window": {
                "type": "integer",
                "minimum": 10,
                "maximum": 1000
              }
            }
          },
          "act_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "suggest_act_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string",
            "minLength": 1
          },
          "severity": {
            "enum": [
              "error",
              "warning"
            ]
          },
          "quote_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          "since": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "x-message-ru": "дата в виде ГГГГ-ММ-ДД или пусто"
          }
        }
      }
    }
  }
}
