{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://glint.joinfoundry.xyz/schemas/glint-manifest-v1.json",
  "title": "Glint Manifest v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "name", "version"],
  "properties": {
    "$schema": { "type": "string", "format": "uri" },
    "schemaVersion": { "const": 1 },
    "name": { "type": "string", "minLength": 2, "maxLength": 120 },
    "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[a-zA-Z0-9.-]+)?$" },
    "entry": { "const": "index.html", "default": "index.html" },
    "engine": {
      "type": "string",
      "enum": ["vanilla", "phaser", "threejs", "pixijs", "kaplay", "babylon", "unity", "godot", "gamemaker", "defold", "wasm", "other"],
      "default": "vanilla"
    },
    "display": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "orientation": { "type": "string", "enum": ["landscape", "portrait", "any"], "default": "landscape" },
        "aspectRatio": { "type": "string", "enum": ["16:9", "4:3", "9:16", "free"], "default": "16:9" },
        "backgroundColor": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$", "default": "#0b0e14" },
        "fullscreen": { "type": "boolean", "default": true }
      }
    },
    "inputs": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "supported": {
          "type": "array",
          "items": { "type": "string", "enum": ["keyboard", "mouse", "gamepad", "touch"] },
          "minItems": 1,
          "maxItems": 4
        },
        "primary": { "type": "string", "enum": ["keyboard", "mouse", "gamepad", "touch"] },
        "touchPlayable": { "type": "boolean" },
        "mobileOptimized": {
          "type": "boolean",
          "description": "True when the game also runs great on mobile screens and touch controls (all Glint games remain playable on desktop)."
        },
        "gamepad": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "boolean", "default": true },
            "deadzone": { "type": "number", "minimum": 0, "maximum": 0.5, "default": 0.15 },
            "actions": {
              "type": "array",
              "maxItems": 32,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["id", "label", "default"],
                "properties": {
                  "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" },
                  "label": { "type": "string", "minLength": 1, "maxLength": 48 },
                  "kind": { "type": "string", "enum": ["button", "trigger", "axis2d"], "default": "button" },
                  "default": {
                    "type": "string",
                    "enum": [
                      "south", "east", "west", "north", "lb", "rb", "lt", "rt",
                      "select", "start", "l3", "r3",
                      "dpad_up", "dpad_down", "dpad_left", "dpad_right",
                      "left_stick", "right_stick", "dpad"
                    ]
                  },
                  "description": { "type": "string", "maxLength": 120 }
                }
              }
            }
          }
        }
      }
    },
    "multiplayer": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "local": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "boolean" },
            "minPlayers": { "type": "integer", "minimum": 1, "maximum": 16 },
            "maxPlayers": { "type": "integer", "minimum": 2, "maximum": 16 },
            "mode": { "type": "string", "enum": ["same_screen", "split_screen", "pass_and_play"] }
          }
        },
        "online": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": { "type": "boolean" },
            "minPlayers": { "type": "integer", "minimum": 2, "maximum": 16 },
            "maxPlayers": { "type": "integer", "minimum": 2, "maximum": 16 },
            "model": { "type": "string", "enum": ["turn_based", "realtime"] },
            "allowJoinInProgress": { "type": "boolean" },
            "allowSpectators": { "type": "boolean" },
            "matchmaking": { "type": "string", "enum": ["invite_only", "public", "both"] }
          }
        }
      }
    },
    "capabilities": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "threads": { "type": "boolean", "default": false },
        "pointerLock": { "type": "boolean", "default": false },
        "webgl2": { "type": "boolean", "default": false },
        "webgpu": { "type": "boolean", "default": false }
      }
    },
    "sdk": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "features": {
          "type": "array",
          "items": { "type": "string", "enum": ["saves", "achievements", "leaderboards", "multiplayer", "input"] },
          "maxItems": 5
        },
        "devMock": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "achievements": {
              "type": "array",
              "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" },
              "maxItems": 100
            },
            "leaderboards": {
              "type": "array",
              "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" },
              "maxItems": 20
            }
          }
        }
      }
    }
  }
}
