{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Firewall Policy Mirroring Rules",
  "type": "object",
  "additionalProperties": false,
  "patternProperties": {
    "^[a-z0-9_-]+$": {
      "$ref": "#/$defs/rule"
    }
  },
  "$defs": {
    "rule": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "priority"
      ],
      "properties": {
        "priority": {
          "type": "number"
        },
        "action": {
          "type": "string",
          "enum": [
            "mirror",
            "do_not_mirror",
            "goto_next"
          ]
        },
        "description": {
          "type": "string"
        },
        "disabled": {
          "type": "boolean"
        },
        "security_profile_group": {
          "type": "string"
        },
        "target_tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tls_inspect": {
          "type": "boolean"
        },
        "match": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "destination_ranges": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "source_ranges": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "source_tags": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "layer4_configs": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "protocol": {
                    "type": "string"
                  },
                  "ports": {
                    "type": "array"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
