{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "description": "The running config for policyd",
  "markdownDescription": "The startup config for the [policyd](https://docs.halon.io/policyd)",
  "additionalProperties": false,
  "required": [
    "version"
  ],
  "properties": {
    "version": {
      "type": "string",
      "enum": [
        "1.1"
      ],
      "description": "The software version the configuration was created for"
    },
    "authentication": {
      "type": "object",
      "description": "The authentication settings",
      "additionalProperties": false,
      "properties": {
        "apikeys": {
          "type": "array",
          "description": "The API keys",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ips": {
      "type": "object",
      "description": "The IP addresses",
      "additionalProperties": {
        "type": "object",
        "required": [],
        "properties": {
          "groupings": {
            "type": "array",
            "description": "The groupings",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "grouping",
                "mode",
                "start"
              ],
              "properties": {
                "grouping": {
                  "type": "string",
                  "pattern": "^(?!(?:\/.*\/|#.*|.*[*].*)$).*$",
                  "minLength": 1
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "AUTO",
                    "MANUAL"
                  ]
                },
                "paused": {
                  "type": "boolean",
                  "description": "Indicates whether the grouping is paused for that IP address",
                  "default": false
                },
                "start": {
                  "type": "object",
                  "description": "IP warmup start configuration for the grouping",
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date",
                      "minLength": 1,
                      "description": "The date when the IP warmup starts for the grouping"
                    },
                    "volume": {
                      "type": "number",
                      "minimum": 0,
                      "description": "The starting volume for IP warmup for the grouping"
                    }
                  },
                  "required": [
                    "date"
                  ],
                  "additionalProperties": false
                },
                "end": {
                  "type": "object",
                  "description": "IP warmup end configuration for the grouping",
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date",
                      "minLength": 1,
                      "description": "The date goal when the IP warmup should reach the target volume for the grouping"
                    },
                    "volume": {
                      "type": "number",
                      "minimum": 0,
                      "description": "The target volume for IP warmup for the grouping"
                    }
                  },
                  "required": [],
                  "additionalProperties": false
                },
                "algorithm": {
                  "type": "string",
                  "enum": [
                    "tokenbucket",
                    "fixedwindow"
                  ],
                  "default": "tokenbucket",
                  "description": "The rate-limiting algorithm for the grouping"
                },
                "interval": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 86400,
                  "default": 86400,
                  "description": "The rate-limiting interval (in seconds)"
                },
                "schedule": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "day",
                      "messages"
                    ],
                    "properties": {
                      "day": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 356
                      },
                      "messages": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 4294967295
                      }
                    }
                  }
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": {
                    "oneOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}