{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opengdd.org/schema/core/v0.8/tuning.schema.json",
  "title": "OpenGDD v0.7 tuning file",
  "type": "object",
  "required": ["values"],
  "additionalProperties": false,
  "$comment": "Cross-field rules stay validator-level: every ranges key MUST exist in values, each minimum MUST NOT exceed its maximum, each value MUST lie inside its own range, and every rule MUST parse and hold over the package defaults.",
  "properties": {
    "values": {
      "type": "object",
      "propertyNames": { "$ref": "#/$defs/tuningKey" },
      "additionalProperties": { "type": "number" },
      "description": "Required flat map of dotted keys to finite JSON numbers."
    },
    "ranges": {
      "type": "object",
      "propertyNames": { "$ref": "#/$defs/tuningKey" },
      "additionalProperties": {
        "type": "array",
        "minItems": 2,
        "maxItems": 2,
        "items": { "type": "number" }
      },
      "description": "Optional inclusive [minimum, maximum] bounds. A key with a range may be personalized."
    },
    "rules": {
      "type": "object",
      "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
      "additionalProperties": { "type": "string", "minLength": 1 },
      "description": "Optional named one-line rules over values."
    }
  },
  "$defs": {
    "tuningKey": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\\.[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?)+$",
      "$comment": "Reserved first and extension segments are validator-level because the reserved list is versioned.",
      "description": "A flat dotted key with at least two segments."
    }
  }
}
