{
    "definitions": {
        "IcmpRule": {
            "additionalProperties": false,
            "properties": {
                "cidr": {
                    "type": "string"
                },
                "icmpcode": {
                    "maximum": 255,
                    "minimum": -1,
                    "type": "integer"
                },
                "icmptype": {
                    "maximum": 255,
                    "minimum": -1,
                    "type": "integer"
                },
                "protocol": {
                    "const": "icmp",
                    "type": "string"
                },
                "ruleid": {
                    "minLength": 1,
                    "type": "string"
                }
            },
            "required": [
                "ruleid",
                "protocol",
                "icmpcode",
                "icmptype",
                "cidr"
            ],
            "type": "object"
        },
        "RulesArray": {
            "errorMessage": {
                "uniqueItemProperties": "should NOT contain objects with the same ruleId"
            },
            "items": {
                "anyOf": [
                    {
                        "$ref": "#/definitions/TcpUdpRule"
                    },
                    {
                        "$ref": "#/definitions/IcmpRule"
                    }
                ]
            },
            "type": "array",
            "uniqueItemProperties": [
                "ruleid"
            ]
        },
        "TcpUdpPort": {
            "maximum": 65535,
            "minimum": 0,
            "type": "integer"
        },
        "TcpUdpRule": {
            "additionalProperties": false,
            "properties": {
                "cidr": {
                    "type": "string"
                },
                "endport": {
                    "$ref": "#/definitions/TcpUdpPort"
                },
                "protocol": {
                    "enum": [
                        "tcp",
                        "udp"
                    ],
                    "type": "string"
                },
                "ruleid": {
                    "minLength": 1,
                    "type": "string"
                },
                "startport": {
                    "$ref": "#/definitions/TcpUdpPort"
                }
            },
            "required": [
                "ruleid",
                "protocol",
                "startport",
                "endport",
                "cidr"
            ],
            "type": "object"
        }
    },
    "errorMessage": {
        "uniqueItemProperties": "should NOT contain objects with the same id"
    },
    "items": {
        "additionalProperties": false,
        "properties": {
            "description": {
                "type": "string"
            },
            "egressrule": {
                "$ref": "#/definitions/RulesArray"
            },
            "id": {
                "minLength": 1,
                "type": "string"
            },
            "ingressrule": {
                "$ref": "#/definitions/RulesArray"
            },
            "name": {
                "minLength": 1,
                "type": "string"
            },
            "preselected": {
                "type": "boolean"
            }
        },
        "required": [
            "id",
            "name",
            "description",
            "preselected",
            "ingressrule",
            "egressrule"
        ],
        "type": "object"
    },
    "type": "array",
    "uniqueItemProperties": [
        "id"
    ]
}