{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pitgun.io/schemas/bundle-manifest/v1",
  "title": "Pitgun Bundle Manifest v1",
  "type": "object",
  "additionalProperties": false,

  "required": ["manifest_version", "bundle", "bolts"],
  "properties": {
    "manifest_version": {
      "type": "integer",
      "enum": [1]
    },

    "bundle": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "description": "Semantic or human-readable version"
        },
        "description": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        }
      }
    },

    "bolts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "ast"],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "Bolt/formula identifier"
          },

          "ast": {
            "type": "string",
            "minLength": 1,
            "description": "Relative path to the AST JSON file"
          },

          "inputs": {
            "type": "array",
            "items": { "type": "string" },
            "uniqueItems": true,
            "description": "Channels or metrics required for this bolt"
          },

          "output": {
            "type": "string",
            "minLength": 1,
            "description": "Name of the generated metric"
          },

          "params": {
            "type": "object",
            "description": "Optional bolt-level param definitions",
            "additionalProperties": true
          }
        }
      }
    }
  }
}