{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://overseer.studio/schemas/preset/manifest.json",
  "title": "Overseer Preset Manifest",
  "description": "Schema for a preset manifest.json inside an Overseer plugin package",
  "type": "object",
  "required": ["id", "label", "description", "category", "version", "icon", "state"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Reference to this schema"
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "description": "Unique preset identifier within the plugin"
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "description": "Human-readable preset name shown in the preset picker"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "description": "Short description of the preset"
    },
    "category": {
      "type": "string",
      "minLength": 1,
      "description": "Category used for grouping in the preset picker"
    },
    "version": {
      "type": "string",
      "minLength": 1,
      "description": "Preset version"
    },
    "author": {
      "type": "string",
      "description": "Author of this preset"
    },
    "publisher": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Publisher names shown alongside the preset"
    },
    "icon": {
      "oneOf": [
        {
          "type": "string",
          "description": "Built-in icon name (reserved for internal presets)"
        },
        {
          "type": "object",
          "required": ["$ref"],
          "additionalProperties": false,
          "properties": {
            "$ref": { "type": "string", "description": "Relative path to the icon file" }
          },
          "description": "Preset icon reference"
        }
      ],
      "description": "Preset icon"
    },
    "state": {
      "type": "object",
      "required": ["currentScreen", "screens", "tiles"],
      "properties": {
        "currentScreen": {
          "type": "string",
          "description": "Id of the screen shown when the preset loads"
        },
        "screens": {
          "type": "array",
          "description": "Screens included in the preset"
        },
        "tiles": {
          "type": "array",
          "description": "Tiles included in the preset"
        }
      },
      "description": "Persisted session state snapshot applied when the preset is used"
    },
    "assets": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["$ref", "id"],
        "additionalProperties": false,
        "properties": {
          "$ref": { "type": "string", "description": "Relative path to the asset file" },
          "id": {
            "type": "string",
            "enum": ["background", "screenshot"],
            "description": "Role of this asset within the preset"
          }
        }
      },
      "description": "Asset files bundled with the preset"
    },
    "tags": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Search tags for this preset"
    }
  }
}
