{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "allowConnections": {
          "type": "boolean"
        },
        "builtinLocale": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "builtinLocale is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "cluster": {
          "properties": {
            "name": {
              "default": "",
              "type": "string"
            }
          },
          "type": "object",
          "x-kubernetes-map-type": "atomic"
        },
        "collationVersion": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "collationVersion is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "connectionLimit": {
          "type": "integer"
        },
        "databaseReclaimPolicy": {
          "default": "retain",
          "enum": [
            "delete",
            "retain"
          ],
          "type": "string"
        },
        "encoding": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "encoding is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "ensure": {
          "default": "present",
          "enum": [
            "present",
            "absent"
          ],
          "type": "string"
        },
        "extensions": {
          "items": {
            "properties": {
              "ensure": {
                "default": "present",
                "enum": [
                  "present",
                  "absent"
                ],
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "schema": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "fdws": {
          "items": {
            "properties": {
              "ensure": {
                "default": "present",
                "enum": [
                  "present",
                  "absent"
                ],
                "type": "string"
              },
              "handler": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "options": {
                "items": {
                  "properties": {
                    "ensure": {
                      "default": "present",
                      "enum": [
                        "present",
                        "absent"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "value"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "owner": {
                "type": "string"
              },
              "usage": {
                "items": {
                  "properties": {
                    "name": {
                      "type": "string",
                      "x-kubernetes-validations": [
                        {
                          "message": "name is required",
                          "rule": "self != ''"
                        }
                      ]
                    },
                    "type": {
                      "default": "grant",
                      "enum": [
                        "grant",
                        "revoke"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "validator": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "icuLocale": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "icuLocale is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "icuRules": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "icuRules is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "isTemplate": {
          "type": "boolean"
        },
        "locale": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "locale is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "localeCType": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "localeCType is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "localeCollate": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "localeCollate is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "localeProvider": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "localeProvider is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "name": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "name is immutable",
              "rule": "self == oldSelf"
            },
            {
              "message": "the name postgres is reserved",
              "rule": "self != 'postgres'"
            },
            {
              "message": "the name template0 is reserved",
              "rule": "self != 'template0'"
            },
            {
              "message": "the name template1 is reserved",
              "rule": "self != 'template1'"
            }
          ]
        },
        "owner": {
          "type": "string"
        },
        "schemas": {
          "items": {
            "properties": {
              "ensure": {
                "default": "present",
                "enum": [
                  "present",
                  "absent"
                ],
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "owner": {
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "servers": {
          "items": {
            "properties": {
              "ensure": {
                "default": "present",
                "enum": [
                  "present",
                  "absent"
                ],
                "type": "string"
              },
              "fdw": {
                "type": "string",
                "x-kubernetes-validations": [
                  {
                    "message": "fdw is required",
                    "rule": "self != ''"
                  }
                ]
              },
              "name": {
                "type": "string"
              },
              "options": {
                "items": {
                  "properties": {
                    "ensure": {
                      "default": "present",
                      "enum": [
                        "present",
                        "absent"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "value"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "usage": {
                "items": {
                  "properties": {
                    "name": {
                      "type": "string",
                      "x-kubernetes-validations": [
                        {
                          "message": "name is required",
                          "rule": "self != ''"
                        }
                      ]
                    },
                    "type": {
                      "default": "grant",
                      "enum": [
                        "grant",
                        "revoke"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "fdw",
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "tablespace": {
          "type": "string"
        },
        "template": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "template is immutable",
              "rule": "self == oldSelf"
            }
          ]
        }
      },
      "required": [
        "cluster",
        "name",
        "owner"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "builtinLocale is only available when localeProvider is set to `builtin`",
          "rule": "!has(self.builtinLocale) || self.localeProvider == 'builtin'"
        },
        {
          "message": "icuLocale is only available when localeProvider is set to `icu`",
          "rule": "!has(self.icuLocale) || self.localeProvider == 'icu'"
        },
        {
          "message": "icuRules is only available when localeProvider is set to `icu`",
          "rule": "!has(self.icuRules) || self.localeProvider == 'icu'"
        }
      ]
    },
    "status": {
      "properties": {
        "applied": {
          "type": "boolean"
        },
        "extensions": {
          "items": {
            "properties": {
              "applied": {
                "type": "boolean"
              },
              "message": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "applied",
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "fdws": {
          "items": {
            "properties": {
              "applied": {
                "type": "boolean"
              },
              "message": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "applied",
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "message": {
          "type": "string"
        },
        "observedGeneration": {
          "format": "int64",
          "type": "integer"
        },
        "schemas": {
          "items": {
            "properties": {
              "applied": {
                "type": "boolean"
              },
              "message": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "applied",
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "servers": {
          "items": {
            "properties": {
              "applied": {
                "type": "boolean"
              },
              "message": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "applied",
              "name"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "metadata",
    "spec"
  ],
  "type": "object"
}
