{
  "version": 1,
  "transport": {
    "protocol": "wotbox-beta-1",
    "type": "SYS",
    "app_id": "wbim",
    "action": "game"
  },
  "peer_data": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "schema": {
        "type": "number",
        "const": 1
      },
      "event": {
        "type": "string",
        "enum": [
          "invite",
          "accept",
          "decline",
          "move",
          "sync",
          "state"
        ]
      },
      "game_id": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      },
      "revision": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "cell": {
        "type": "integer",
        "minimum": 0,
        "maximum": 36
      },
      "request_id": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      },
      "by": {
        "type": "string",
        "enum": [
          "human",
          "agent"
        ]
      },
      "snapshot": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "number",
            "const": 1
          },
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "host_node": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "host_url": {
            "type": "string",
            "format": "uri"
          },
          "mode": {
            "type": "string",
            "enum": [
              "agent",
              "peer",
              "public"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "invited",
              "active",
              "finished",
              "declined"
            ]
          },
          "board": {
            "minItems": 37,
            "maxItems": 37,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "W",
                    "B"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "turn": {
            "type": "string",
            "enum": [
              "W",
              "B"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "timed": {
            "type": "boolean"
          },
          "remaining": {
            "type": "object",
            "properties": {
              "W": {
                "type": "number",
                "minimum": 0
              },
              "B": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": [
              "W",
              "B"
            ],
            "additionalProperties": false
          },
          "last_tick": {
            "type": "number"
          },
          "created_at": {
            "type": "number"
          },
          "expires_at": {
            "type": "number"
          },
          "moves": {
            "maxItems": 37,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "cell": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 36
                },
                "side": {
                  "type": "string",
                  "enum": [
                    "W",
                    "B"
                  ]
                },
                "at": {
                  "type": "number"
                },
                "by": {
                  "type": "string",
                  "enum": [
                    "human",
                    "agent",
                    "public"
                  ]
                }
              },
              "required": [
                "cell",
                "side",
                "at"
              ],
              "additionalProperties": false
            }
          },
          "result": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "W",
                  "B",
                  "draw"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "schema",
          "game_id",
          "host_node",
          "host_url",
          "mode",
          "state",
          "board",
          "turn",
          "revision",
          "timed",
          "remaining",
          "last_tick",
          "created_at",
          "expires_at",
          "moves",
          "result",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "schema",
      "event",
      "game_id"
    ],
    "additionalProperties": false
  },
  "snapshot": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "schema": {
        "type": "number",
        "const": 1
      },
      "game_id": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      },
      "host_node": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      },
      "host_url": {
        "type": "string",
        "format": "uri"
      },
      "mode": {
        "type": "string",
        "enum": [
          "agent",
          "peer",
          "public"
        ]
      },
      "state": {
        "type": "string",
        "enum": [
          "waiting",
          "invited",
          "active",
          "finished",
          "declined"
        ]
      },
      "board": {
        "minItems": 37,
        "maxItems": 37,
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "W",
                "B"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "turn": {
        "type": "string",
        "enum": [
          "W",
          "B"
        ]
      },
      "revision": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "timed": {
        "type": "boolean"
      },
      "remaining": {
        "type": "object",
        "properties": {
          "W": {
            "type": "number",
            "minimum": 0
          },
          "B": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "W",
          "B"
        ],
        "additionalProperties": false
      },
      "last_tick": {
        "type": "number"
      },
      "created_at": {
        "type": "number"
      },
      "expires_at": {
        "type": "number"
      },
      "moves": {
        "maxItems": 37,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "cell": {
              "type": "integer",
              "minimum": 0,
              "maximum": 36
            },
            "side": {
              "type": "string",
              "enum": [
                "W",
                "B"
              ]
            },
            "at": {
              "type": "number"
            },
            "by": {
              "type": "string",
              "enum": [
                "human",
                "agent",
                "public"
              ]
            }
          },
          "required": [
            "cell",
            "side",
            "at"
          ],
          "additionalProperties": false
        }
      },
      "result": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "W",
              "B",
              "draw"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "reason": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 40
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "schema",
      "game_id",
      "host_node",
      "host_url",
      "mode",
      "state",
      "board",
      "turn",
      "revision",
      "timed",
      "remaining",
      "last_tick",
      "created_at",
      "expires_at",
      "moves",
      "result",
      "reason"
    ],
    "additionalProperties": false
  },
  "tools": {
    "wbhex_list": {
      "description": "List private games and pending invitations",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_create": {
      "description": "Create WB Four against a connected human, an agent or a public visitor",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "agent",
              "peer",
              "public"
            ]
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "minutes": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 180
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "mode",
          "minutes",
          "request_id"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_get": {
      "description": "Read and resynchronise an authorized game",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "game_id"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_move": {
      "description": "Place a token in a game; agent moves require game settings and grants",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "cell": {
            "type": "integer",
            "minimum": 0,
            "maximum": 36
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "game_id",
          "cell",
          "revision",
          "request_id"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_respond": {
      "description": "Accept or decline a game invitation",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "accept": {
            "type": "boolean"
          }
        },
        "required": [
          "game_id",
          "accept"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_wait_event": {
      "description": "Wait up to 20 seconds for a game event; a connected agent can tell the human or follow AFK permissions",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "after": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "seconds": {
            "default": 15,
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          }
        },
        "required": [
          "after",
          "seconds"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_events": {
      "description": "Read game events after a cursor. Poll while assisting; no background agent is assumed",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "after": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "after"
        ],
        "additionalProperties": false
      },
      "public": false
    },
    "wbhex_public_list": {
      "description": "List open public games, when enabled by this owner",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "public": true
    },
    "wbhex_public_join": {
      "description": "Join one public game and receive its private game capability",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "game_id"
        ],
        "additionalProperties": false
      },
      "public": true
    },
    "wbhex_public_get": {
      "description": "Read only the game authorized by a game capability",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "token": {
            "type": "string",
            "minLength": 32,
            "maxLength": 128
          }
        },
        "required": [
          "game_id",
          "token"
        ],
        "additionalProperties": false
      },
      "public": true
    },
    "wbhex_public_move": {
      "description": "Play one turn using a game capability; no Wotbox account access is granted",
      "arguments": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "game_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "cell": {
            "type": "integer",
            "minimum": 0,
            "maximum": 36
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "token": {
            "type": "string",
            "minLength": 32,
            "maxLength": 128
          }
        },
        "required": [
          "game_id",
          "cell",
          "revision",
          "request_id",
          "token"
        ],
        "additionalProperties": false
      },
      "public": true
    }
  }
}
