{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://slashpaf.com/audioforge/library.schema.v1.json",
  "title": "Audio Forge library.json v1",
  "description": "Schema for library.json inside an Audio Forge library ZIP archive.",
  "type": "object",
  "minProperties": 1,
  "maxProperties": 1,
  "patternProperties": {
    "^.+$": {
      "$ref": "#/$defs/library"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "library": {
      "type": "object",
      "properties": {
        "Music": {
          "$ref": "#/$defs/categoryMap"
        },
        "Ambiance": {
          "$ref": "#/$defs/categoryMap"
        },
        "Sound": {
          "$ref": "#/$defs/categoryMap"
        },
        "__installedPacks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/installedPack"
          }
        }
      },
      "additionalProperties": false
    },
    "categoryMap": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/category"
      }
    },
    "installedPack": {
      "type": "object",
      "required": ["packType", "id"],
      "properties": {
        "packType": {
          "type": "string",
          "minLength": 1
        },
        "id": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "category": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "packName": {
          "type": ["string", "null"]
        },
        "packId": {
          "type": ["string", "null"]
        },
        "icon": {
          "type": ["integer", "null"]
        },
        "iconFamily": {
          "type": ["string", "null"]
        },
        "iconPackage": {
          "type": ["string", "null"]
        },
        "iconRef": {
          "anyOf": [
            {
              "$ref": "#/$defs/iconRef"
            },
            {
              "type": "null"
            }
          ]
        },
        "color": {
          "type": ["integer", "null"]
        },
        "isDefault": {
          "type": ["boolean", "null"]
        },
        "singleLoop": {
          "type": ["boolean", "null"]
        },
        "oneShot": {
          "type": ["boolean", "null"]
        },
        "singlePlayTransitionTo": {
          "type": ["string", "null"]
        },
        "singlePlayTransitionMs": {
          "type": ["integer", "null"]
        },
        "singlePlayTransitionTrackCount": {
          "type": ["integer", "null"],
          "minimum": 1
        },
        "singlePlayStopPlayback": {
          "type": ["boolean", "null"]
        },
        "timerEnabled": {
          "type": ["boolean", "null"]
        },
        "enabled": {
          "type": ["boolean", "null"]
        },
        "index": {
          "type": ["integer", "null"]
        },
        "key": {
          "type": ["string", "null"]
        },
        "minPause": {
          "type": ["integer", "null"],
          "minimum": 0
        },
        "maxPause": {
          "type": ["integer", "null"],
          "minimum": 0
        },
        "crossfadeDuration": {
          "type": ["number", "null"]
        },
        "transitionsEnabled": {
          "type": ["boolean", "null"]
        },
        "nameIntl": {
          "type": ["object", "null"],
          "additionalProperties": {
            "type": "string"
          }
        },
        "version": {
          "type": ["integer", "null"]
        },
        "initialVolume": {
          "type": ["number", "null"]
        },
        "targetVolume": {
          "type": ["number", "null"]
        },
        "initialTransition": {
          "type": ["integer", "null"],
          "minimum": 0
        },
        "initialPlaybackSpeed": {
          "type": ["number", "null"],
          "exclusiveMinimum": 0
        },
        "ambianceDuckingPercent": {
          "type": ["number", "null"],
          "minimum": 0,
          "maximum": 100
        },
        "iconType": {
          "type": ["string", "null"],
          "enum": ["fontIcon", "customIcon", null]
        },
        "customIconPath": {
          "type": ["string", "null"]
        }
      },
      "additionalProperties": false
    },
    "iconRef": {
      "type": "object",
      "required": ["pack", "name"],
      "properties": {
        "pack": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": ["integer", "null"]
        }
      },
      "additionalProperties": false
    }
  }
}
