{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cheeleong.dev/wwn-system-json/systems/equipment.schema.json",
  "title": "WWN Equipment",
  "type": "object",
  "properties": {
    "@type": { "const": "Equipment" },
    "equipmentType": { "enum": ["gear", "bundle", "service", "hireling", "transport", "armor", "shield", "weapon", "magicItem", "scroll", "potion", "device"] },
    "cost": { "$ref": "https://cheeleong.dev/wwn-system-json/systems/common.schema.json#/$defs/Cost" },
    "encumbrance": { "type": ["integer", "string"] },
    "quantity": { "type": ["integer", "string"], "minimum": 1 },
    "traits": { "type": "array", "items": { "type": "string" } },
    "damage": { "type": ["string", "object"] },
    "shock": { "type": ["string", "object"] },
    "range": { "type": ["string", "object"] },
    "weaponTraits": { "type": "array", "items": { "$ref": "https://cheeleong.dev/wwn-system-json/systems/common.schema.json#/$defs/NodeReference" } },
    "armorClass": { "type": "integer" },
    "charges": { "type": ["integer", "string"] },
    "effects": { "type": "array", "items": { "type": ["string", "object"] } }
  },
  "allOf": [
    { "$ref": "https://cheeleong.dev/wwn-system-json/systems/common.schema.json#/$defs/Entity" },
    { "if": { "properties": { "equipmentType": { "const": "gear" } }, "required": ["equipmentType"] }, "then": { "not": { "anyOf": [{ "required": ["armorClass"] }, { "required": ["damage"] }, { "required": ["weaponTraits"] }] } } },
    { "if": { "properties": { "equipmentType": { "const": "weapon" } }, "required": ["equipmentType"] }, "then": { "required": ["damage"] } },
    { "if": { "properties": { "equipmentType": { "const": "armor" } }, "required": ["equipmentType"] }, "then": { "not": { "required": ["damage"] } } },
    { "if": { "properties": { "equipmentType": { "const": "shield" } }, "required": ["equipmentType"] }, "then": { "not": { "required": ["damage"] } } }
  ],
  "required": ["source", "equipmentType"],
  "unevaluatedProperties": false
}
