{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ForgeCast plugin manifest (plugin.json)",
  "type": "object",
  "required": [
    "id",
    "name",
    "version"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "description": "A unique name for the plugin: 3-40 characters, lowercase letters, digits and single hyphens. It must be the same as the folder's name.",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "minLength": 3,
      "maxLength": 40
    },
    "name": {
      "type": "string",
      "description": "The name people see.",
      "minLength": 1,
      "maxLength": 60
    },
    "version": {
      "type": "string",
      "description": "Like 1.0.0.",
      "pattern": "^\\d+\\.\\d+\\.\\d+([-+].+)?$"
    },
    "author": {
      "type": "string",
      "description": "Who made it."
    },
    "description": {
      "type": "string",
      "description": "What it does, in a sentence or two.",
      "maxLength": 500
    },
    "homepage": {
      "type": "string",
      "description": "Where to read more."
    },
    "main": {
      "type": "string",
      "description": "The Lua file that starts the plugin, inside this folder.",
      "default": "main.lua",
      "pattern": "\\.lua$"
    },
    "api": {
      "type": "integer",
      "description": "The plugin API version this plugin is written for.",
      "enum": [
        1
      ],
      "default": 1
    },
    "permissions": {
      "type": "array",
      "description": "What the plugin may do. The person who turns it on sees this list and approves it.",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "chat.read",
          "chat.middleware",
          "stream.read",
          "ui.notify",
          "ui.modal",
          "ui.window",
          "ui.dashboard",
          "storage",
          "sounds",
          "alerts",
          "bus",
          "network",
          "app.open_url",
          "overlay",
          "obs",
          "ai",
          "history",
          "system",
          "activity",
          "media",
          "tts",
          "clipboard",
          "ui.app",
          "points",
          "viewers",
          "youtube.chat",
          "youtube.moderate",
          "youtube.manage",
          "hotkeys",
          "lights",
          "homeassistant",
          "midi",
          "microphone",
          "donations",
          "oauth",
          "discord"
        ],
        "enumDescriptions": [
          "Read chat: chats.get, chats.on, chats.random…",
          "Filter chat: chats.use (block or change messages before they are shown)",
          "Read stream stats: stream.state, stream.on…",
          "Show notifications: ui.notify",
          "Show dialogs: ui.modal, ui.confirm, ui.prompt…",
          "Open windows: window.create",
          "Add to the Dashboard: dashboard.section, plugin.settings",
          "Keep its own data: storage.*",
          "Play sounds: sounds.play",
          "Show alerts: alerts.show",
          "Talk to other plugins: bus.*",
          "Use the internet over https: http.*",
          "Open links in the browser: app.open_url",
          "Show its own values in your overlays: overlay.set ({{plugin.<id>.<name>}})",
          "Control OBS: obs.state, obs.set_scene, obs.set_mute, obs.set_source_visible, obs.on",
          "Use ForgeCast's AI, paid with your AI credits: ai.ask",
          "Read the streams recorded on this PC: history.streams, history.week, history.on",
          "Read the PC's numbers: system.usage, system.specs, system.battery, system.keep_awake…",
          "Know when you're away and what game you play: activity.idle_ms, activity.game, activity.on",
          "See what music is playing: media.now_playing, media.on",
          "Speak out loud: tts.say, tts.voices, tts.stop",
          "Copy text to the clipboard: clipboard.copy",
          "Add to the app: ui.page, ui.command, chats.menu, chats.decorate",
          "Channel points: points.get, points.add, points.take, redeems.add, predictions.start…",
          "Regular viewers: viewers.get, viewers.top, viewers.count",
          "Chat as your channel: youtube.send_chat, youtube.poll, youtube.end_poll",
          "Moderate your live chat: youtube.delete_message, youtube.timeout, youtube.ban, youtube.unban",
          "Change your live stream: youtube.set_title, youtube.set_description",
          "Global hotkeys: hotkeys.on, hotkeys.off",
          "Smart lights: lights.set, lights.flash, lights.off, lights.list",
          "Home Assistant: homeassistant.call, homeassistant.state, homeassistant.states",
          "MIDI: midi.on, midi.send, midi.devices",
          "Microphone: speech.listen, captions.on",
          "Tips: donations.on, donations.recent",
          "Connected services: oauth.connect, oauth.request, oauth.status",
          "Discord: discord.send, discord.channels"
        ]
      }
    },
    "optional_permissions": {
      "type": "array",
      "description": "Permissions the plugin asks for only when a feature needs them, with plugin.request(permission, why). The plugin starts without them.",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "chat.read",
          "chat.middleware",
          "stream.read",
          "ui.notify",
          "ui.modal",
          "ui.window",
          "ui.dashboard",
          "storage",
          "sounds",
          "alerts",
          "bus",
          "network",
          "app.open_url",
          "overlay",
          "obs",
          "ai",
          "history",
          "system",
          "activity",
          "media",
          "tts",
          "clipboard",
          "ui.app",
          "points",
          "viewers",
          "youtube.chat",
          "youtube.moderate",
          "youtube.manage",
          "hotkeys",
          "lights",
          "homeassistant",
          "midi",
          "microphone",
          "donations",
          "oauth",
          "discord"
        ],
        "enumDescriptions": [
          "Read chat: chats.get, chats.on, chats.random…",
          "Filter chat: chats.use (block or change messages before they are shown)",
          "Read stream stats: stream.state, stream.on…",
          "Show notifications: ui.notify",
          "Show dialogs: ui.modal, ui.confirm, ui.prompt…",
          "Open windows: window.create",
          "Add to the Dashboard: dashboard.section, plugin.settings",
          "Keep its own data: storage.*",
          "Play sounds: sounds.play",
          "Show alerts: alerts.show",
          "Talk to other plugins: bus.*",
          "Use the internet over https: http.*",
          "Open links in the browser: app.open_url",
          "Show its own values in your overlays: overlay.set ({{plugin.<id>.<name>}})",
          "Control OBS: obs.state, obs.set_scene, obs.set_mute, obs.set_source_visible, obs.on",
          "Use ForgeCast's AI, paid with your AI credits: ai.ask",
          "Read the streams recorded on this PC: history.streams, history.week, history.on",
          "Read the PC's numbers: system.usage, system.specs, system.battery, system.keep_awake…",
          "Know when you're away and what game you play: activity.idle_ms, activity.game, activity.on",
          "See what music is playing: media.now_playing, media.on",
          "Speak out loud: tts.say, tts.voices, tts.stop",
          "Copy text to the clipboard: clipboard.copy",
          "Add to the app: ui.page, ui.command, chats.menu, chats.decorate",
          "Channel points: points.get, points.add, points.take, redeems.add, predictions.start…",
          "Regular viewers: viewers.get, viewers.top, viewers.count",
          "Chat as your channel: youtube.send_chat, youtube.poll, youtube.end_poll",
          "Moderate your live chat: youtube.delete_message, youtube.timeout, youtube.ban, youtube.unban",
          "Change your live stream: youtube.set_title, youtube.set_description",
          "Global hotkeys: hotkeys.on, hotkeys.off",
          "Smart lights: lights.set, lights.flash, lights.off, lights.list",
          "Home Assistant: homeassistant.call, homeassistant.state, homeassistant.states",
          "MIDI: midi.on, midi.send, midi.devices",
          "Microphone: speech.listen, captions.on",
          "Tips: donations.on, donations.recent",
          "Connected services: oauth.connect, oauth.request, oauth.status",
          "Discord: discord.send, discord.channels"
        ]
      }
    },
    "library": {
      "type": "boolean",
      "description": "A library: other plugins load its modules with lib.require. It never runs by itself.",
      "default": false
    },
    "libraries": {
      "type": "array",
      "description": "The library plugins this one uses with lib.require (by their id).",
      "uniqueItems": true,
      "maxItems": 20,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      }
    }
  }
}
