{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://blackautumn.divinevtt.com/modding/schemas/brain.schema.json",
  "title": "brain file",
  "description": "Which people, and which parts of their brain the mod's graph functions stand in for, switch off or add.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "this schema's address, for an editor"
    },
    "brain": {
      "type": "integer",
      "description": "the brain file format",
      "minimum": 1,
      "maximum": 1
    },
    "title": {
      "type": "string"
    },
    "note": {
      "type": "string"
    },
    "for": {
      "anyOf": [
        {
          "type": "object",
          "description": "which people: every list given must hold, any one entry of each",
          "properties": {
            "kits": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sides": {
              "type": "array",
              "items": {
                "enum": [
                  "Neutral",
                  "Player",
                  "Civilian",
                  "Soldier",
                  "Bandit"
                ]
              }
            },
            "roles": {
              "type": "array",
              "items": {
                "enum": [
                  "lawman",
                  "guard",
                  "archer",
                  "rider",
                  "leader",
                  "band",
                  "villager",
                  "knight",
                  "unarmed"
                ]
              }
            },
            "tunings": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "names": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "const": "given"
        }
      ]
    },
    "use": {
      "type": "object",
      "propertyNames": {
        "enum": [
          "Decide",
          "Clutch.Score",
          "Clutch.Running",
          "Clutch.Begin",
          "Clutch.End",
          "Care.Score",
          "Care.Running",
          "Care.Begin",
          "Care.End",
          "Fright.Score",
          "Fright.Running",
          "Fright.Begin",
          "Fright.End",
          "Law.Score",
          "Law.Running",
          "Law.Begin",
          "Law.End",
          "Engage.Score",
          "Engage.Running",
          "Engage.Begin",
          "Engage.End",
          "Routine.Score",
          "Routine.Running",
          "Routine.Begin",
          "Routine.End",
          "Whom",
          "Care.Withdraw",
          "Care.Self",
          "FallBack",
          "Blows",
          "AfterBlow",
          "Guard",
          "Day",
          "Bark",
          "Care.Help"
        ]
      },
      "additionalProperties": {
        "type": "string",
        "description": "a function of the mod's graphs, by name, or fn/<mod>.<Name>"
      },
      "description": "a part to the function standing in for it"
    },
    "off": {
      "type": "array",
      "description": "activities of ours switched off",
      "items": {
        "enum": [
          "Clutch",
          "Care",
          "Fright",
          "Law",
          "Engage",
          "Routine"
        ]
      }
    },
    "add": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "an activity of the mod's own",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_]+$",
            "description": "its name; in the game <mod id>.<name>"
          },
          "title": {
            "type": "string"
          },
          "score": {
            "type": "string",
            "description": "the function saying how much it wants it, 0 to 1"
          },
          "running": {
            "type": "string"
          },
          "begin": {
            "type": "string"
          },
          "end": {
            "type": "string"
          },
          "before": {
            "enum": [
              "Clutch",
              "Care",
              "Fright",
              "Law",
              "Engage",
              "Routine"
            ],
            "description": "weighed before this activity of ours (Routine)"
          }
        },
        "required": [
          "name",
          "score"
        ]
      }
    },
    "every": {
      "type": "number",
      "description": "how often they weigh up what to do, in seconds",
      "minimum": 0.05,
      "maximum": 5.0
    },
    "stickiness": {
      "type": "number",
      "description": "how much an activity under way has to be beaten by",
      "minimum": 0.0,
      "maximum": 1.0
    }
  },
  "additionalProperties": false
}
