{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "Modifier.schema.json",
  "title": "Modifier",
  "x-group": "Entity",
  "type": "object",
  "description": "A rule modifier that changes an entity attribute.\n\nModifiers describe how a value should be applied to an attribute, such as\nadding a bonus, overriding an existing value, or upgrading a value according\nto game-system rules.",
  "properties": {
    "id": {
      "type": "string",
      "description": "A stable unique identifier for this modifier."
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether this modifier is currently active."
    },
    "name": {
      "type": "string",
      "description": "The display name of the modifier."
    },
    "mode": {
      "$ref": "#/$defs/Mode",
      "description": "The operation used when applying this modifier."
    },
    "attribute": {
      "type": "string",
      "description": "The attribute path or key affected by this modifier."
    },
    "value": {
      "type": "string",
      "description": "The modifier value.\n\nThe value is stored as text so game systems can interpret numbers,\nformulas, dice expressions, or custom data as needed."
    },
    "scope": {
      "$ref": "#/$defs/Scope",
      "description": "The context in which this modifier applies."
    }
  },
  "required": [
    "id",
    "enabled"
  ],
  "additionalProperties": false,
  "$defs": {
    "Mode": {
      "title": "Mode",
      "description": "The operation used to apply a modifier to an attribute.",
      "type": "string",
      "enum": [
        "override",
        "add",
        "multiply",
        "upgrade",
        "downgrade",
        "custom"
      ]
    },
    "Scope": {
      "title": "Scope",
      "description": "The context in which a modifier is applied.",
      "type": "string",
      "enum": [
        "self",
        "global"
      ]
    }
  }
}
