{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://blackautumn.divinevtt.com/modding/schemas/patches.schema.json",
  "title": "patches",
  "description": "A file of patch entries ([ ... ] or { \"patches\": [ ... ] }). An entry does one of patch, add, remove, place or build.",
  "$defs": {
    "entry": {
      "type": "object",
      "description": "one patch entry",
      "properties": {
        "patch": {
          "type": "string",
          "pattern": "^(thing|item|quest|dialogue|asset|rp|map|res)/.+",
          "description": "changes one there is, by its address"
        },
        "add": {
          "type": "string",
          "pattern": "^(thing|item|quest|dialogue|asset|rp|map|res)/.+",
          "description": "makes a new one, a copy of from"
        },
        "remove": {
          "type": "string",
          "pattern": "^(thing|item|quest|dialogue|asset|rp|map|res)/.+",
          "description": "takes an RP row or a map object away; with path, a list's element"
        },
        "place": {
          "type": "string",
          "pattern": "^(thing|item)/.+",
          "description": "puts a thing (or an item) in a scene every time it loads"
        },
        "build": {
          "type": "string",
          "pattern": "\\.map\\.json$",
          "description": "builds a map file into one of our scenes"
        },
        "from": {
          "type": "string",
          "pattern": "^(thing|item|quest|dialogue|asset|rp|map|res)/.+",
          "description": "what add copies"
        },
        "set": {
          "type": "object",
          "description": "paths to values: Component.field, Child/Path:Component.field, list[2], list+, list-, active..."
        },
        "file": {
          "type": "string",
          "description": "a dialogue's text, a file of the mod"
        },
        "translations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "a dialogue's text in other languages"
        },
        "path": {
          "type": "string"
        },
        "paths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "scene": {
          "type": "string",
          "description": "the scene a place or build entry is for"
        },
        "at": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "minItems": 2,
          "maxItems": 2,
          "description": "where it is placed, [x, y] in the scene"
        },
        "id": {
          "type": "string",
          "description": "a placed one's own id"
        },
        "count": {
          "type": "integer",
          "description": "how many items",
          "minimum": 1
        },
        "facing": {
          "type": "number",
          "description": "its turn in degrees",
          "minimum": -360.0,
          "maximum": 360.0
        },
        "note": {
          "type": "string",
          "description": "a comment"
        },
        "//": {
          "type": "string",
          "description": "a comment"
        }
      },
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "patch"
          ]
        },
        {
          "required": [
            "add"
          ]
        },
        {
          "required": [
            "remove"
          ]
        },
        {
          "required": [
            "place"
          ]
        },
        {
          "required": [
            "build"
          ]
        }
      ]
    }
  },
  "anyOf": [
    {
      "type": "array",
      "items": {
        "$ref": "#/$defs/entry"
      }
    },
    {
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string"
        },
        "patches": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/entry"
          }
        }
      },
      "required": [
        "patches"
      ]
    },
    {
      "$ref": "#/$defs/entry"
    }
  ]
}
