{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "activated_policy_types": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "description": {
      "type": "string"
    },
    "iam": {
      "$ref": "#/$defs/iam"
    },
    "iam_bindings": {
      "$ref": "#/$defs/iam_bindings"
    },
    "iam_bindings_additive": {
      "$ref": "#/$defs/iam_bindings_additive"
    },
    "tags": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^.+$": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "description": {
              "type": "string"
            },
            "iam": {
              "$ref": "#/$defs/iam"
            },
            "iam_bindings": {
              "$ref": "#/$defs/iam_bindings"
            },
            "iam_bindings_additive": {
              "$ref": "#/$defs/iam_bindings_additive"
            }
          }
        }
      }
    }
  },
  "$defs": {
    "iam": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^(?:roles/|\\$custom_roles:)": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(?:domain:|group:|serviceAccount:|user:|principal:|principalSet:|\\$iam_principals:[a-z0-9_-]+)"
          }
        }
      }
    },
    "iam_bindings": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z0-9_-]+$": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "members",
            "role"
          ],
          "properties": {
            "members": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(?:domain:|group:|serviceAccount:|user:|principal:|principalSet:|\\$iam_principals:[a-z0-9_-]+)"
              }
            },
            "role": {
              "type": "string",
              "pattern": "^(?:roles/|\\$custom_roles:)"
            },
            "condition": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "expression",
                "title"
              ],
              "properties": {
                "expression": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "iam_bindings_additive": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z0-9_-]+$": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "member",
            "role"
          ],
          "properties": {
            "member": {
              "type": "string",
              "pattern": "^(?:domain:|group:|serviceAccount:|user:|principal:|principalSet:|\\$iam_principals:[a-z0-9_-]+)"
            },
            "role": {
              "type": "string",
              "pattern": "^(?:roles/|\\$custom_roles:)"
            },
            "condition": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "expression",
                "title"
              ],
              "properties": {
                "expression": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
