{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wavemaster.local/schema/wavemaster-pro.schema.json",
  "title": "WaveMaster Pro Project Settings",
  "type": "object",
  "required": [
    "schemaVersion",
    "profile",
    "targetLufs",
    "auto",
    "modules",
    "export"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "2.0.0"
    },
    "profile": {
      "type": "string",
      "enum": [
        "Radio",
        "Studio",
        "Hot",
        "Podcast",
        "Custom"
      ]
    },
    "targetLufs": {
      "type": "number",
      "minimum": -30,
      "maximum": -4
    },
    "auto": {
      "type": "object",
      "required": [
        "eq",
        "compressor",
        "limiter",
        "loudness",
        "strength"
      ],
      "properties": {
        "eq": {
          "type": "boolean"
        },
        "compressor": {
          "type": "boolean"
        },
        "limiter": {
          "type": "boolean"
        },
        "loudness": {
          "type": "boolean"
        },
        "strength": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "modules": {
      "type": "object",
      "required": [
        "input",
        "master",
        "eq",
        "compressor",
        "limiter",
        "safety"
      ],
      "properties": {
        "input": {
          "type": "object",
          "properties": {
            "gainDb": {
              "type": "number",
              "minimum": -24,
              "maximum": 24
            },
            "trimInMs": {
              "type": "number",
              "minimum": 0,
              "maximum": 60000
            },
            "trimOutMs": {
              "type": "number",
              "minimum": 0,
              "maximum": 60000
            }
          }
        },
        "master": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "preTrimDb": {
              "type": "number",
              "minimum": -24,
              "maximum": 24
            },
            "finalOutputDb": {
              "type": "number",
              "minimum": -24,
              "maximum": 24
            },
            "stereoWidth": {
              "type": "number",
              "minimum": 0,
              "maximum": 2
            },
            "low": {
              "$ref": "#/$defs/toneBand"
            },
            "mid": {
              "$ref": "#/$defs/toneBand"
            },
            "high": {
              "$ref": "#/$defs/toneBand"
            }
          }
        },
        "eq": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "mix": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "bands": {
              "type": "array",
              "minItems": 8,
              "maxItems": 8,
              "items": {
                "$ref": "#/$defs/eqBand"
              }
            }
          }
        },
        "compressor": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "thresholdDb": {
              "type": "number",
              "minimum": -60,
              "maximum": 0
            },
            "ratio": {
              "type": "number",
              "minimum": 1,
              "maximum": 20
            },
            "attackMs": {
              "type": "number",
              "minimum": 0.1,
              "maximum": 200
            },
            "releaseMs": {
              "type": "number",
              "minimum": 10,
              "maximum": 2000
            },
            "kneeDb": {
              "type": "number",
              "minimum": 0,
              "maximum": 24
            },
            "makeupDb": {
              "type": "number",
              "minimum": -24,
              "maximum": 24
            },
            "mix": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "mode": {
              "type": "string",
              "enum": [
                "rms",
                "peak"
              ]
            },
            "sidechainHpfHz": {
              "type": "number",
              "minimum": 0,
              "maximum": 500
            },
            "stereoLink": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "autoMakeup": {
              "type": "boolean"
            }
          }
        },
        "limiter": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "ceilingDb": {
              "type": "number",
              "minimum": -12,
              "maximum": 0
            },
            "lookaheadMs": {
              "type": "number",
              "minimum": 0,
              "maximum": 20
            },
            "releaseMs": {
              "type": "number",
              "minimum": 5,
              "maximum": 1000
            },
            "truePeak": {
              "type": "boolean"
            }
          }
        },
        "safety": {
          "type": "object",
          "properties": {
            "on": {
              "type": "boolean"
            },
            "ceilingDb": {
              "type": "number",
              "minimum": -12,
              "maximum": 0
            },
            "lookaheadMs": {
              "type": "number",
              "minimum": 0,
              "maximum": 20
            },
            "releaseMs": {
              "type": "number",
              "minimum": 5,
              "maximum": 1000
            }
          }
        }
      }
    },
    "export": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "wav16",
            "wav24",
            "wav32f"
          ]
        },
        "sampleRate": {
          "type": "string",
          "enum": [
            "original",
            "44100",
            "48000",
            "88200",
            "96000",
            "192000"
          ]
        },
        "dither": {
          "type": "boolean"
        },
        "filenameTemplate": {
          "type": "string"
        },
        "zipBatch": {
          "type": "boolean"
        }
      }
    },
    "batch": {
      "type": "object",
      "properties": {
        "albumMode": {
          "type": "boolean"
        },
        "sequence": {
          "type": "string",
          "enum": [
            "manual",
            "filename",
            "duration"
          ]
        },
        "crossfadeMs": {
          "type": "number",
          "minimum": 0,
          "maximum": 10000
        },
        "perTrackAuto": {
          "type": "boolean"
        }
      }
    }
  },
  "$defs": {
    "toneBand": {
      "type": "object",
      "properties": {
        "gainDb": {
          "type": "number",
          "minimum": -12,
          "maximum": 12
        },
        "freqHz": {
          "type": "number",
          "minimum": 20,
          "maximum": 20000
        },
        "q": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 12
        }
      }
    },
    "eqBand": {
      "type": "object",
      "required": [
        "id",
        "type",
        "freqHz",
        "q",
        "gainDb"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "lowShelf",
            "peak",
            "highShelf"
          ]
        },
        "freqHz": {
          "type": "number",
          "minimum": 20,
          "maximum": 20000
        },
        "q": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 24
        },
        "gainDb": {
          "type": "number",
          "minimum": -18,
          "maximum": 18
        },
        "enabled": {
          "type": "boolean"
        }
      }
    }
  }
}