{
  "!name": "esh-script-scope",
  "!define": {
      "Item": {
          "getName": {
              "!doc": "The name of the item",
              "!type": "fn() -> string"
          },
          "getState": {
              "!doc": "The current state of the item",
              "!type": "fn() -> ESHState"
          },
          "getLabel": {
              "!doc": "The label of the item",
              "!type": "fn() -> string"
          },
          "getType": {
              "!doc": "The type of the item",
              "!type": "fn() -> string"
          },
          "getGroupNames": {
              "!doc": "An array of group names the item belongs to",
              "!type": "fn() -> [string]"
          },
          "getTags": {
              "!doc": "An array of tag names attached to the item",
              "!type": "fn() -> [string]"
          },
          "hasTag": {
              "!doc": "Returns whether or not the item has the specified tag",
              "!type": "fn(string) -> boolean"
          }
      },
      "ScriptBusEvent": {
          "postUpdate": {
              "!doc": "Posts a status update for a specified item to the event bus.",
              "!type": "fn(itemName: string, state: ?)"
          },
          "sendCommand": {
              "!doc": "Sends a command for a specified item to the event bus.",
              "!type": "fn(itemName: string, command: ?)"
          }
      },
      "ItemRegistry": {
          "getItem": {
              "!doc": "This method retrieves a single item from the registry.",
              "!type": "fn(name: string) -> Item"
          },
          "getItemsOfType": {
              "!doc": "This method retrieves all items with the given type",
              "!type": "fn(type: string) -> [Item]"
          },
          "getItems": {
              "!doc": "This method retrieves all items that match an (optional) given search pattern",
              "!type": "fn(pattern?: string) -> [Item]"
          },
          "getItemsByTag": {
              "!doc": "Returns a list of items containing all of the given tags.",
              "!type": "fn(tag?: [string]) -> [Item]"
          },
          "getItemsByTagAndType": {
              "!doc": "Returns a list of items with a certain type containing all of the given tags.",
              "!type": "fn(type: string, pattern?: [string]) -> [Item]"
          }
      },
      "ESHEvent": {
          "getSource": {
              "!doc": "The source of the event",
              "!type": "fn() -> string"
          },
          "getType": {
              "!doc": "The type of the event",
              "!type": "fn() -> string"
          },
          "getTopic": {
              "!doc": "The topic of the event",
              "!type": "fn() -> string"
          },
          "getPayload": {
              "!doc": "The payload of the event",
              "!type": "fn() -> string"
          },
          "toString": {
              "!doc": "Returns a string representation of the event",
              "!type": "fn() -> string"
          }
      },
      "ESHState": {
          "toString": {
              "!doc": "Returns a string representation of the state",
              "!type": "fn() -> string"
          }
      },
      "TriggerType": {
          "cronExpression": {
              "!doc": "The cron expression for the event (timer.GenericCronTrigger)",
              "!type": "string"
          },
          "time": {
              "!doc": "The time of the event in \"hh:mm\" format (timer.TimeOfDayTrigger)",
              "!type": "string"
          },
          "itemName": {
              "!doc": "The name of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger, core.ItemCommandTrigger)",
              "!type": "string"
          },
          "state": {
              "!doc": "The state of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger)",
              "!type": "string"
          },
          "previousState": {
              "!doc": "The previous state of the item that triggered the event (core.ItemStateChangeTrigger)",
              "!type": "string"
          },
          "command": {
              "!doc": "The command of the item that triggered the event (core.ItemCommandTrigger)",
              "!type": "string"
          },
          "channelUID": {
              "!doc": "The channelUID of the channel that triggered the event (core.ChannelEventTrigger)",
              "!type": "string"
          },
          "event": {
              "!doc": "The event of the channel that triggered the event (core.ChannelEventTrigger)",
              "!type": "string"
          },
          "eventTopic": {
              "!doc": "The topic of the event (core.GenericEventTrigger)",
              "!type": "string"
          },
          "eventSource": {
              "!doc": "The Item name, ChannelUID, ThingUID, etc (core.GenericEventTrigger)",
              "!type": "string"
          },
          "eventTypes": {
              "!doc": "The event type (core.GenericEventTrigger)",
              "!type": "string"
          }
      }
  },
  "events": {
      "!doc": "Provides functionality to send commands to the openHAB event bus",
      "!type": "ScriptBusEvent"
  },
  "itemRegistry": {
      "!doc": "The Item Registry provides access to the list of openHAB items and their state",
      "!type": "ItemRegistry"
  },
  "ir": {
      "!doc": "Alias for itemRegistry",
      "!type": "ItemRegistry"
  },
  "event": {
      "!doc": "Data passed from triggers.",
      "!type": "TriggerType"
  },

  "ON": "OnOffType",
  "OFF": "OnOffType",
  "MOVE": "StopMoveType",
  "STOP": "StopMoveType",
  "OPEN": "OpenClosedType",
  "CLOSED": "OpenClosedType",
  "DOWN": "UpDownType",
  "UP": "UpDownType"
}
