{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/praetorium-gg/json-schema/praetorium-gg-unit-index-schema.json",
  "title": "UnitIndex",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/praetorium-gg-v1-openapi.json#/components/schemas/UnitIndex",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "faction": {
      "$ref": "#/$defs/FactionSummary"
    },
    "battleSize": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "nonMatchedPlay": {
      "type": "boolean"
    },
    "query": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "detachment": {
      "anyOf": [
        {
          "$ref": "#/$defs/Detachment"
        },
        {
          "type": "null"
        }
      ]
    },
    "units": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UnitSummary"
      }
    },
    "revisions": {
      "$ref": "#/$defs/Revisions"
    }
  },
  "required": [
    "faction",
    "battleSize",
    "nonMatchedPlay",
    "query",
    "detachment",
    "units",
    "revisions"
  ],
  "$defs": {
    "Detachment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "catalogueId": {
          "type": "string"
        },
        "faction": {
          "type": "string"
        },
        "factionSlug": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "points": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "dispositions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NamedRule"
          }
        },
        "enhancements": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PointedRule"
          }
        },
        "upgrades": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PointedRule"
          }
        },
        "stratagems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Stratagem"
          }
        },
        "keywordRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/KeywordRule"
          }
        },
        "attribution": {
          "type": "string"
        },
        "provenance": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "definitions": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "revision": {
                  "type": "string"
                },
                "detachmentId": {
                  "type": "string"
                }
              },
              "required": [
                "revision",
                "detachmentId"
              ]
            },
            "rules": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "revision": {
                  "type": "string"
                }
              },
              "required": [
                "revision"
              ]
            },
            "datacards": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "revision": {
                  "type": "string"
                }
              },
              "required": [
                "revision"
              ]
            }
          },
          "required": [
            "definitions",
            "rules",
            "datacards"
          ]
        }
      },
      "required": [
        "catalogueId",
        "faction",
        "factionSlug",
        "id",
        "slug",
        "name",
        "points",
        "dispositions",
        "rules",
        "enhancements",
        "upgrades",
        "stratagems",
        "keywordRules",
        "attribution",
        "provenance"
      ]
    },
    "FactionSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "datasheets": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "detachments": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "id",
        "slug",
        "name",
        "datasheets",
        "detachments"
      ],
      "additionalProperties": false
    },
    "KeywordRule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "description"
      ]
    },
    "NamedRule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "description"
      ]
    },
    "PointedRule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "points": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "points",
        "description"
      ]
    },
    "Revisions": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "Stratagem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "cp": {
          "type": "integer"
        },
        "type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "phases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "turn": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "name",
        "cp",
        "type",
        "phases",
        "turn",
        "description"
      ]
    },
    "UnitSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "group": {
          "type": "string"
        },
        "allied": {
          "type": "boolean"
        },
        "alliedFaction": {
          "type": [
            "string",
            "null"
          ]
        },
        "points": {
          "type": [
            "number",
            "null"
          ]
        },
        "limit": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "composition": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "costs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "models": {
                "type": "string"
              },
              "cost": {
                "type": "string"
              },
              "keyword": {
                "type": "string"
              },
              "faction": {
                "type": "string"
              },
              "detachment": {
                "type": "string"
              },
              "copies": {
                "type": "string"
              }
            },
            "required": [
              "models",
              "cost"
            ],
            "additionalProperties": false
          }
        },
        "canLead": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "canSupport": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "canBeLedBy": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "canBeSupportedBy": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "referenceId": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "slug",
        "name",
        "group",
        "allied",
        "alliedFaction",
        "points",
        "limit",
        "keywords",
        "composition",
        "costs",
        "canLead",
        "canSupport",
        "canBeLedBy",
        "canBeSupportedBy",
        "url",
        "referenceId"
      ],
      "additionalProperties": false
    }
  }
}