{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Universal Manifest Schema",
  "description": "Schema for defining metadata about applications, extensions, and backend services.",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable name of the app/service."
    },
    "short_name": {
      "type": "string",
      "description": "Abbreviated name (used in PWA or UI contexts)."
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Semantic version number (semver)."
    },
    "description": {
      "type": "string",
      "description": "Detailed explanation of the service/app."
    },
    "type": {
      "type": "string",
      "enum": ["pwa", "browser-extension", "backend-service"],
      "description": "The manifest type."
    },
    "owner": {
      "type": "string",
      "description": "Team or system owner responsible."
    },
    "start_url": {
      "type": "string",
      "description": "Entry point (PWA or web app)."
    },
    "display": {
      "type": "string",
      "enum": ["fullscreen", "standalone", "minimal-ui", "browser"],
      "description": "PWA display mode."
    },
    "icons": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "src": { "type": "string" },
          "sizes": { "type": "string" },
          "type": { "type": "string" }
        },
        "required": ["src", "sizes", "type"]
      }
    },
    "background": {
      "type": "object",
      "properties": {
        "service_worker": { "type": "string" }
      }
    },
    "permissions": {
      "type": "array",
      "items": { "type": "string" },
      "description": "List of permissions (extensions)."
    },
    "endpoints": {
      "type": "array",
      "description": "Backend API endpoints exposed.",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "method": { "type": "string", "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"] },
          "path": { "type": "string" }
        },
        "required": ["name", "method", "path"]
      }
    },
    "dependencies": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Other services this depends on."
    },
    "scaling": {
      "type": "object",
      "properties": {
        "min_replicas": { "type": "integer" },
        "max_replicas": { "type": "integer" },
        "cpu_threshold": { "type": "integer" }
      }
    }
  },
  "required": ["name", "version", "type"]
}