{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.invalid/charts/orders/values.schema.json",
  "title": "orders chart values",
  "description": "Validation schema for the orders chart values files. Fictional; validates the paired defaults and production overrides.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "replicaCount",
    "image",
    "service"
  ],
  "properties": {
    "replicaCount": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "image": {
      "type": "object",
      "required": [
        "repository"
      ],
      "properties": {
        "repository": {
          "type": "string",
          "pattern": "^registry\\.example\\.invalid/"
        },
        "tag": {
          "type": "string"
        },
        "pullPolicy": {
          "enum": [
            "Always",
            "IfNotPresent",
            "Never"
          ]
        }
      },
      "additionalProperties": false
    },
    "service": {
      "type": "object",
      "required": [
        "type",
        "port"
      ],
      "properties": {
        "type": {
          "enum": [
            "ClusterIP",
            "NodePort",
            "LoadBalancer"
          ]
        },
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535
        }
      },
      "additionalProperties": false
    },
    "resources": {
      "type": "object",
      "properties": {
        "requests": {
          "$ref": "#/$defs/quantities"
        },
        "limits": {
          "$ref": "#/$defs/quantities"
        }
      },
      "additionalProperties": false
    },
    "autoscaling": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "minReplicas": {
          "type": "integer",
          "minimum": 1
        },
        "maxReplicas": {
          "type": "integer",
          "minimum": 1
        },
        "targetCPUUtilizationPercentage": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "additionalProperties": false
    },
    "env": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "podAnnotations": {
      "type": [
        "object",
        "null"
      ]
    },
    "nodeSelector": {
      "type": "object"
    },
    "tolerations": {
      "type": "array"
    }
  },
  "$defs": {
    "quantities": {
      "type": "object",
      "properties": {
        "cpu": {
          "type": "string",
          "pattern": "^[0-9]+m?$"
        },
        "memory": {
          "type": "string",
          "pattern": "^[0-9]+(Mi|Gi)$"
        }
      },
      "additionalProperties": false
    }
  }
}
