{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "blockception.minecraft.resource.sounds.json",
  "type": "object",
  "title": "Sounds.json",
  "description": "Sound definitions.",
  "additionalProperties": false,
  "definitions": {
    "pitch": {
      "title": "Pitch",
      "oneOf": [
        { "default": 1, "type": "number", "description": "A defined pitch." },
        {
          "description": "A random selection between a minimum and maximum.",
          "type": "array",
          "items": [
            { "type": "number", "minimum": 0, "title": "Minimum" },
            { "type": "number", "minimum": 0, "title": "Maximum" }
          ]
        }
      ]
    },
    "volume": {
      "title": "Volume",
      "oneOf": [
        { "default": 1, "type": "number", "description": "A defined volume." },
        {
          "description": "A random selection between a minimum and maximum.",
          "type": "array",
          "items": [
            { "type": "number", "minimum": 0, "title": "Minimum" },
            { "type": "number", "minimum": 0, "title": "Maximum" }
          ]
        }
      ]
    },
    "sound_event": {
      "title": "Sound Event",
      "description": "A single sound event definition.",
      "oneOf": [
        { "type": "string" },
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["sound"],
          "properties": {
            "volume": { "$ref": "#/definitions/volume" },
            "sound": { "type": "string", "title": "Sound Event", "description": "The sound event described in sound_definitions.json" },
            "pitch": { "$ref": "#/definitions/pitch" }
          }
        }
      ]
    },
    "entity_event": {
      "type": "object",
      "title": "Entity Sound",
      "description": "Entity sound definitions.",
      "properties": {
        "volume": { "$ref": "#/definitions/volume" },
        "pitch": { "$ref": "#/definitions/pitch" },
        "events": {
          "type": "object",
          "title": "Events",
          "propertyNames": { "pattern": "[a-z\\._]+" },
          "additionalProperties": { "$ref": "#/definitions/sound_event" }
        }
      }
    }
  },
  "properties": {
    "block_sounds": {
      "type": "object",
      "title": "Block Sounds",
      "description": "Block sound definitions.",
      "additionalProperties": {
        "type": "object",
        "title": "Block Sound",
        "description": "A single block sound definition.",
        "additionalProperties": false,
        "properties": {
          "volume": { "$ref": "#/definitions/volume" },
          "pitch": { "$ref": "#/definitions/pitch" },
          "events": {
            "type": "object",
            "title": "Events",
            "propertyNames": {
              "enum": [
                "break_pot",
                "break",
                "button.click_off",
                "button.click_on",
                "default",
                "door.close",
                "door.open",
                "fall",
                "fence_gate.close",
                "fence_gate.open",
                "hit",
                "item.use.on",
                "place",
                "power.off",
                "power.on",
                "pressure_plate.click_off",
                "pressure_plate.click_on",
                "shatter_pot",
                "step",
                "trapdoor.close",
                "trapdoor.open"
              ]
            },
            "additionalProperties": { "$ref": "#/definitions/sound_event" }
          }
        }
      }
    },
    "entity_sounds": {
      "type": "object",
      "title": "Entity Sounds",
      "description": "Entity sounds definitions.",
      "additionalProperties": false,
      "properties": {
        "defaults": { "$ref": "#/definitions/entity_event" },
        "entities": {
          "type": "object",
          "title": "Entities",
          "description": "Entities definitions.",
          "additionalProperties": { "$ref": "#/definitions/entity_event" }
        }
      }
    },
    "individual_event_sounds": {
      "type": "object",
      "title": "Individual Event Sounds",
      "description": "Individual event sounds definitions.",
      "additionalProperties": false,
      "properties": {
        "events": { "type": "object", "title": "Events", "description": "Events.", "additionalProperties": { "$ref": "#/definitions/sound_event" } }
      }
    },
    "interactive_sounds": {
      "type": "object",
      "title": "Interactive Sounds",
      "description": "Interactive sounds definitions.",
      "additionalProperties": false,
      "properties": {
        "block_sounds": {
          "type": "object",
          "title": "Block Sounds",
          "description": "Block sound definitions.",
          "additionalProperties": {
            "type": "object",
            "title": "Block Sound",
            "description": "A single block sound definition.",
            "additionalProperties": false,
            "properties": {
              "volume": { "$ref": "#/definitions/volume" },
              "pitch": { "$ref": "#/definitions/pitch" },
              "events": {
                "type": "object",
                "title": "Events",
                "propertyNames": { "enum": ["default", "fall", "step", "hit", "jump", "land"] },
                "additionalProperties": {
                  "title": "Sound Event",
                  "description": "A single sound event definition.",
                  "oneOf": [
                    { "type": "string" },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "minProperties": 1,
                      "properties": {
                        "volume": { "$ref": "#/definitions/volume" },
                        "sound": { "type": "string", "title": "Sound Event", "description": "The sound event described in sound_definitions.json" },
                        "pitch": { "$ref": "#/definitions/pitch" }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "entity_sounds": {
          "type": "object",
          "title": "Entity Sounds",
          "description": "Entity sound definitions.",
          "additionalProperties": false,
          "properties": {
            "defaults": {
              "type": "object",
              "title": "Defaults",
              "description": "Default sound definitions.",
              "additionalProperties": {
                "type": "object",
                "title": "Entity Sounds",
                "properties": {
                  "events": {
                    "type": "object",
                    "title": "Entity Events",
                    "propertyNames": { "pattern": "[a-z0-9\\.]+" },
                    "additionalProperties": {
                      "type": "object",
                      "title": "Entity Event",
                      "description": "A single entity event.",
                      "additionalProperties": { "type": "string", "title": "A Sound Interaction" }
                    }
                  }
                }
              },
              "properties": { "volume": { "$ref": "#/definitions/volume" }, "pitch": { "$ref": "#/definitions/pitch" } }
            },
            "entities": {
              "type": "object",
              "title": "Entites Sounds",
              "description": "Entities sound definitions.",
              "additionalProperties": {
                "type": "object",
                "title": "Entity Sounds",
                "properties": {
                  "volume": { "$ref": "#/definitions/volume" },
                  "pitch": { "$ref": "#/definitions/pitch" },
                  "events": {
                    "type": "object",
                    "title": "Entity Events",
                    "propertyNames": { "pattern": "[a-z0-9\\.]+" },
                    "additionalProperties": {
                      "type": "object",
                      "title": "Entity Event",
                      "description": "A single entity event.",
                      "additionalProperties": { "type": "string", "title": "A Sound Interaction" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
