{
  "$schema": "http://json-schema.org/schema",
  "title": "WSA AppCompat Database",
  "description": "Shim configurations for Android apps",
  "type": "object",
  "required": [ "$schema" ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "const": "appcompatdb_schema.json"
    }
  },
  "patternProperties": {
    "^([A-Za-z]{1}[A-Za-z\\d_]*\\.)+[A-Za-z][A-Za-z\\d_]*$": {
      "type": "object",
      "required": [ "DisplayName", "Version" ],
      "additionalProperties": false,
      "properties": {
        "DisplayName": {
          "type": "string"
        },
        "Version": {
          "type": "object",
          "required": [ "Any" ],
          "additionalProperties": false,
          "properties": {
            "Any": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "Comment": {
                  "type": "string"
                },
                "SwipeForArrowKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Injects quick swipes in the direction of the arrow keys"
                },
                "SlideForArrowKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Emulates keeping a finger down indefinitely and sliding it in the direction of the arrow keys"
                },
                "TapForArrowKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Injects taps in the half of the window corresponding to the arrow key"
                },
                "AimForArrowKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Emulates pan gestures with acceleration in the direction of the arrow keys to pivot the game camera"
                },
                "ForceNonResizeableApp": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Forces Android's resize compatibility mode for the app"
                },
                "GamePadButtonsForKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Translates keyboard keys to virtual gamepad buttons"
                },
                "TapForKeys": {
                  "$ref": "#/definitions/TapForKeys*"
                },
                "JoystickForWASDKeys": {
                  "$ref": "#/definitions/Joystick*"
                },
                "JoystickForArrowKeys": {
                  "$ref": "#/definitions/Joystick*"
                },
                "GamePadDPadForKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Translates keyboard keys to virtual gamepad DPad"
                },
                "GamePadLeftJoystickForKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Translates keyboard keys to virtual gamepad left joystick"
                },
                "GamePadRightJoystickForKeys": {
                  "enum": [ "Enabled", "Disabled" ],
                  "description": "Translates keyboard keys to virtual gamepad right joystick"
                },
                "GamePadButtonStart": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonBack": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftStick": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightStick": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftShoulder": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightShoulder": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonA": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonB": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonX": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonY": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftTrigger": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightTrigger": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonDPadUp": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonDPadDown": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonDPadLeft": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonDPadRight": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftJoystickUp": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftJoystickDown": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftJoystickLeft": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonLeftJoystickRight": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightJoystickUp": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightJoystickDown": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightJoystickLeft": {
                  "$ref": "#/definitions/GampadForKey*"
                },
                "GamePadButtonRightJoystickRight": {
                  "$ref": "#/definitions/GampadForKey*"
                }
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "TapForKeys*": {
      "type": "array",
      "description": "List of mappings from key codes to tap coordinates",
      "items": {
        "type": "array",
        "description": "Maps the key code to tap coordinates",
        "additionalItems": false,
        "minItems": 3,
        "items": [
          {
            "type": "integer",
            "description": "Windows virtual key code",
            "minimum": 8,
            "maximum": 254
          },
          {
            "type": "number",
            "description": "X offset percentage",
            "minimum": 0,
            "maximum": 100
          },
          {
            "type": "number",
            "description": "Y offset percentage",
            "minimum": 0,
            "maximum": 100
          },
          {
            "$ref": "#/definitions/ActionLabel"
          }
        ]
      }
    },
    "Joystick*": {
      "type": "array",
      "description": "Adds a virtual joystick centered at the coordinates",
      "additionalItems": false,
      "minItems": 2,
      "items": [
        {
          "type": "number",
          "description": "X offset percentage",
          "minimum": 0,
          "maximum": 100
        },
        {
          "type": "number",
          "description": "Y offset percentage",
          "minimum": 0,
          "maximum": 100
        }
      ]
    },
    "GampadForKey*": {
      "type": "array",
      "description": "Maps the key code to gamepad control",
      "additionalItems": false,
      "minItems": 1,
      "items": [
        {
          "type": "integer",
          "description": "Windows virtual key code, or zero to remove an existing assignment",
          "minimum": 0,
          "maximum": 254
        },
        {
          "type": "integer",
          "description": "Alternate Windows virtual key code",
          "minimum": 0,
          "maximum": 254
        },
        {
          "$ref": "#/definitions/ActionLabel"
        }
      ]
    },
    "ActionLabel": {
      "enum": [
        "Jump",
        "Boost",
        "Attack",
        "Shoot",
        "Punch",
        "Kick",
        "Block",
        "Sprint",
        "Crouch",
        "Fly",
        "ChangeCamera",
        "Scope",
        "Reload",
        "Handbrake",
        "Drift",
        "ChangeWeapon",
        "UseItem"
      ],
      "description": "Label for key press action"
    }
  }
}