{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "nameOverride": {
      "oneOf": [
        {"type": "string", "minLength": 1},
        {"type": "null"}
      ]
    },
    "fullnameOverride": {
      "oneOf": [
        {"type": "string", "minLength": 1},
        {"type": "null"}
      ]
    },
    "namespaceOverride": {
      "oneOf": [
        {"type": "string", "minLength": 1},
        {"type": "null"}
      ]
    },
    "image": {
      "type": "object",
      "properties": {
        "repository": {"type": "string", "minLength": 1},
        "tag": {
          "oneOf": [
            {"type": "string", "minLength": 1},
            {"type": "null"}
          ]
        },
        "pullPolicy": {
          "oneOf": [
            {"type": "string", "enum": ["Always", "IfNotPresent", "Never"]},
            {"type": "null"}
          ]
        }
      }
    },
    "deployment": {
      "type": "object",
      "properties": {
        "enabled": {"type": "boolean"},
        "replicas": {"type": "integer", "minimum": 0},
        "podAnnotations": {
          "type": "object",
          "additionalProperties": {"type": "string", "minLength": 1}
        },
        "labels": {
          "type": "object",
          "additionalProperties": {"type": "string", "minLength": 1}
        },
        "imagePullSecrets": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {"type": "string"}
            },
            "minProperties": 1
          }
        },
        "securityContext": {
          "type": "object",
          "properties": {
            "runAsNonRoot": {"type": "boolean"},
            "runAsUser": {"type": "integer"},
            "runAsGroup": {"type": "integer"},
            "readOnlyRootFilesystem": {"type": "boolean"},
            "allowPrivilegeEscalation": {"type": "boolean"},
            "capabilities": {
              "type": "object",
              "properties": {
                "drop": {"type": "array", "items": {"type": "string"}},
                "add": {"type": "array", "items": {"type": "string"}}
              }
            }
          }
        },
        "probe": {
          "type": "object",
          "properties": {
            "interval": {"type": "integer", "minimum": 1},
            "initialDelay": {"type": "integer", "minimum": 0}
          }
        },
        "resources": {
          "type": "object",
          "properties": {
            "requests": {
              "type": "object",
              "properties": {
                "cpu": {"type": "string"},
                "memory": {"type": "string"}
              }
            },
            "limits": {
              "type": "object",
              "properties": {
                "cpu": {"type": "string"},
                "memory": {"type": "string"}
              }
            }
          }
        },
        "volumes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {"type": "string"},
              "configMap": {
                "type": "object",
                "properties": {"name": {"type": "string"}}
              },
              "secret": {
                "type": "object",
                "properties": {"secretName": {"type": "string"}}
              },
              "persistentVolumeClaim": {
                "type": "object",
                "properties": {"claimName": {"type": "string"}}
              }
            }
          }
        },
        "volumeMounts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {"type": "string"},
              "mountPath": {"type": "string"},
              "subPath": {"type": "string"},
              "readOnly": {"type": "boolean"}
            }
          }
        },
        "nodeSelector": {
          "type": "object",
          "additionalProperties": {"type": "string", "minLength": 1}
        },
        "affinity": {
          "type": "object",
          "properties": {
            "nodeAffinity": {"type": "object"},
            "podAffinity": {"type": "object"},
            "podAntiAffinity": {"type": "object"}
          }
        },
        "tolerations": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {"type": "string"},
              "operator": {"type": "string"},
              "value": {"type": "string"},
              "effect": {"type": "string"}
            }
          }
        },
        "env": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {"type": "string"},
              "value": {"type": "string"},
              "valueFrom": {"type": "object"}
            }
          }
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "service": {
      "type": "object",
      "properties": {
        "enabled": {"type": "boolean"},
        "annotations": {
          "type": "object",
          "additionalProperties": {"type": "string", "minLength": 1}
        },
        "type": {
          "type": "string",
          "enum": ["ClusterIP", "NodePort", "LoadBalancer"]
        },
        "loadBalancerSourceRanges": {
          "type": "array",
          "items": {"type": "string", "minLength": 1, "pattern": "^\\S+$"},
          "uniqueItems": true
        },
        "port": {"type": "integer", "minimum": 1, "maximum": 65535}
      }
    },
    "traefikMiddleware": {
      "type": "object",
      "properties": {
        "enabled": {"type": "boolean"},
        "statusCodes": {
          "type": "array",
          "items": {"type": "string", "minLength": 3},
          "minItems": 1,
          "examples": [["400-599"], ["404", "500-503"]]
        },
        "query": {
          "type": "string",
          "minLength": 1,
          "examples": ["/{status}.html"]
        }
      }
    },
    "config": {
      "type": "object",
      "properties": {
        "log": {
          "type": "object",
          "properties": {
            "level": {
              "oneOf": [
                {"type": "string", "enum": ["debug", "info", "warn", "error"]},
                {"type": "null"}
              ]
            },
            "format": {
              "oneOf": [
                {"type": "string", "enum": ["console", "json"]},
                {"type": "null"}
              ]
            }
          }
        },
        "listen": {
          "type": "object",
          "properties": {
            "address": {
              "oneOf": [
                {"type": "string", "examples": ["0.0.0.0", "::"]},
                {"type": "null"}
              ]
            },
            "port": {"type": "integer", "minimum": 1, "maximum": 65535}
          }
        },
        "defaultErrorPage": {
          "oneOf": [
            {"type": "integer", "minimum": 100, "maximum": 999},
            {"type": "null"}
          ]
        },
        "sendSameHttpCode": {
          "oneOf": [
            {"type": "boolean"},
            {"type": "null"}
          ]
        },
        "showDetails": {
          "oneOf": [
            {"type": "boolean"},
            {"type": "null"}
          ]
        },
        "proxyHeaders": {
          "oneOf": [
            {
              "type": "array",
              "items": {"type": "string", "minLength": 1, "pattern": "^\\S+$"},
              "examples": [["X-Request-Id", "X-Trace-Id", "X-Correlation-Id"]]
            },
            {"type": "null"}
          ]
        },
        "disableBuiltInCodes": {
          "oneOf": [
            {"type": "boolean"},
            {"type": "null"}
          ]
        },
        "addCode": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "code": {"type": "string", "minLength": 1},
                  "message": {"type": "string", "minLength": 1},
                  "description": {"type": "string", "minLength": 1}
                },
                "required": ["code", "message"],
                "additionalProperties": false
              }
            },
            {"type": "null"}
          ]
        },
        "htmlTemplate": {
          "type": "object",
          "properties": {
            "name": {
              "oneOf": [
                {
                  "type": "string",
                  "enum": [
                    "app-down", "cats", "connection", "ghost", "hacker-terminal",
                    "l7", "lost-in-space", "noise", "orient", "shuffle", "win98"
                  ]
                },
                {"type": "null"}
              ]
            },
            "rotationMode": {
              "oneOf": [
                {
                  "type": "string",
                  "enum": [
                    "disabled", "random-on-startup", "random-on-each-request",
                    "random-hourly", "random-daily"
                  ]
                },
                {"type": "null"}
              ]
            },
            "custom": {
              "oneOf": [
                {"type": "string", "minLength": 1},
                {"type": "null"}
              ]
            }
          }
        },
        "jsonTemplate": {
          "type": "object",
          "properties": {
            "custom": {
              "oneOf": [
                {"type": "string", "minLength": 1},
                {"type": "null"}
              ]
            }
          }
        },
        "xmlTemplate": {
          "type": "object",
          "properties": {
            "custom": {
              "oneOf": [
                {"type": "string", "minLength": 1},
                {"type": "null"}
              ]
            }
          }
        },
        "txtTemplate": {
          "type": "object",
          "properties": {
            "custom": {
              "oneOf": [
                {"type": "string", "minLength": 1},
                {"type": "null"}
              ]
            }
          }
        },
        "homepageUrl": {
          "oneOf": [
            {"type": "string", "minLength": 1},
            {"type": "null"}
          ]
        },
        "addLink": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "label": {"type": "string", "minLength": 1},
                  "url": {"type": "string", "minLength": 1}
                },
                "required": ["label", "url"],
                "additionalProperties": false
              }
            },
            {"type": "null"}
          ]
        },
        "disableL10n": {
          "oneOf": [
            {"type": "boolean"},
            {"type": "null"}
          ]
        }
      }
    }
  }
}
