{
  "$id": "https://dnd-gm.local/schemas/command-proposal.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "targetLocationId"
      ],
      "properties": {
        "kind": {
          "const": "move"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "targetLocationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "ability",
        "difficulty"
      ],
      "properties": {
        "kind": {
          "const": "check"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "ability": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "difficulty": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "clockId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "itemId"
      ],
      "properties": {
        "kind": {
          "const": "take_item"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "itemId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "itemId"
      ],
      "properties": {
        "kind": {
          "const": "use_item"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "itemId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "targetId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "targetNpcId",
        "ability"
      ],
      "properties": {
        "kind": {
          "const": "attack"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "targetNpcId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "ability": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion",
        "factId",
        "recipientPlayerIds"
      ],
      "properties": {
        "kind": {
          "const": "share_fact"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "factId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "recipientPlayerIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "commandId",
        "actorId",
        "expectedStateVersion"
      ],
      "properties": {
        "kind": {
          "const": "end_turn"
        },
        "commandId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "actorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "expectedStateVersion": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  ]
}
