{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://borderlessgaming.net/schemas/preset.schema.json",
  "title": "BorderlessGaming FX Preset",
  "description": "Schema for .bgfxp preset files that define shader effect chains",
  "type": "object",
  "required": ["version", "name", "passes"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON schema reference"
    },
    "version": {
      "type": "integer",
      "description": "File format version for compatibility",
      "const": 1
    },
    "name": {
      "type": "string",
      "description": "Display name for the preset",
      "minLength": 1
    },
    "category": {
      "type": "string",
      "description": "Category for grouping (e.g., 'Upscaling', 'CRT', 'Sharpening')"
    },
    "description": {
      "type": "string",
      "description": "Description of what this preset does"
    },
    "isFavorite": {
      "type": "boolean",
      "description": "Whether this preset is marked as a favorite",
      "default": false
    },
    "passes": {
      "type": "array",
      "description": "Shader passes that make up this preset",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/pass"
      }
    }
  },
  "$defs": {
    "pass": {
      "type": "object",
      "description": "A single shader pass in the effect chain",
      "required": ["effect"],
      "properties": {
        "effect": {
          "type": "string",
          "description": "Relative path to the effect file (e.g., 'FSR/FSR_EASU.hlsl')",
          "pattern": "^[^/\\\\].*\\.hlsl$"
        },
        "scalingType": {
          "type": "string",
          "description": "How scale values are interpreted",
          "enum": ["Normal", "Fit", "Fill", "Absolute"],
          "default": "Normal"
        },
        "scaleX": {
          "type": "number",
          "description": "Scale factor for X axis",
          "default": 1.0,
          "minimum": 0.01
        },
        "scaleY": {
          "type": "number",
          "description": "Scale factor for Y axis",
          "default": 1.0,
          "minimum": 0.01
        },
        "parameters": {
          "type": "object",
          "description": "Parameter overrides keyed by variable name (case-insensitive). Use the HLSL variable name, not the LABEL.",
          "additionalProperties": {
            "type": "number"
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
