{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "enum": [
        "v1"
      ]
    },
    "policies": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^([A-Za-z0-9])+(_?[A-Za-z0-9])*$"
          },
          "isDefault": {
            "type": "boolean"
          },
          "rules": {
            "type": [
              "array",
              "null"
            ],
            "uniqueItems": true,
            "items": {
              "type": "object",
              "properties": {
                "identifier": {
                  "uniqueItems": true,
                  "type": "string",
                  "pattern": "^([A-Za-z0-9\\.])+(_?[A-Za-z0-9\\.])*$"
                },
                "messageOnFailure": {
                  "type": "string"
                }
              },
              "required": [
                "identifier",
                "messageOnFailure"
              ]
            }
          }
        }
      }
    },
    "customRules": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string",
            "pattern": "^([A-Za-z0-9\\.])+(_?[A-Za-z0-9\\.])*$"
          },
          "defaultMessageOnFailure": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "jsonSchema": {
            "type": "string"
          },
          "schema": {
            "type": "object"
          }
        },
        "required": [
          "identifier",
          "name",
          "defaultMessageOnFailure"
        ]
      }
    }
  },
  "required": [
    "apiVersion",
    "policies"
  ]
}
