{
  "$id": "blockception.minecraft.behavior.entities.minecraft.timer",
  "type": "object",
  "title": "Timer",
  "description": "Adds a timer after which an event will fire.",
  "required": [],
  "additionalProperties": false,
  "properties": {
    "looping": {
      "type": "boolean",
      "default": true,
      "description": "If true, the timer will restart every time after it fires.",
      "title": "Looping"
    },
    "randomInterval": {
      "type": "boolean",
      "default": true,
      "description": "If true, the amount of time on the timer will be random between the Minimum and Maximum values specified in time.",
      "title": "Random Interval"
    },
    "time": {
      "description": "Amount of time in seconds for the timer. Can be specified as a number or a pair of numbers (Minimum and max). Incompatible with random_time_choices.",
      "title": "Time",
      "examples": [1, [1.0, 5.0]],
      "oneOf": [
        {
          "type": "array",
          "default": [0.0, 0.0],
          "items": [
            { "type": "number", "title": "Minimum" },
            { "type": "number", "title": "Maximum" }
          ]
        },
        { "type": "number", "default": 0 }
      ]
    },
    "time_down_event": {
      "description": "Event to fire when the time on the timer runs out.",
      "title": "Time Down Event",
      "$ref": "../types/event_object.json"
    },
    "random_time_choices": {
      "type": "array",
      "default": [],
      "description": "This is a list of objects, representing one value in seconds that can be picked before firing the event and an optional weight. Incompatible with time.",
      "title": "Random Time Choices",
      "items": {
        "title": "Random Time Choices",
        "description": "representing one value in seconds that can be picked before firing the event and an optional weight. Incompatible with time.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "weight": {
            "type": "integer",
            "description": "The weight on how likely this section is to trigger.",
            "$comment": "UNDOCUMENTED",
            "title": "Weight"
          },
          "value": {
            "type": "integer",
            "description": "The value in seconds that would be used if this section was picked.",
            "$comment": "UNDOCUMENTED",
            "title": "Value"
          }
        }
      }
    }
  },
  "examples": [
    {
      "time": 1,
      "looping": true,
      "time_down_event": {
        "event": "example:foo",
        "target": "self"
      }
    }
  ]
}
