{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://polisher-suite.local/schemas/manifest.schema.json",
  "title": "Artifact Bundle Manifest",
  "description": "Manifest for a portable artifact bundle. Lists all files with hashes for integrity verification.",
  "type": "object",
  "required": [
    "schema_version",
    "manifest_id",
    "bundle_type",
    "created_at",
    "entries"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "manifest.v1"
    },
    "manifest_id": {
      "type": "string",
      "description": "Unique identifier for this manifest."
    },
    "bundle_type": {
      "type": "string",
      "enum": ["job", "controller-job", "run-log"],
      "description": "What kind of artifact bundle this manifest describes."
    },
    "source_id": {
      "type": "string",
      "description": "The primary artifact ID (job_id, controller_job_id, or run_id)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "type": "string",
      "description": "Software/version that created this bundle."
    },
    "entries": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["filename", "role", "hash_sha256"],
        "properties": {
          "filename": {
            "type": "string",
            "description": "Relative path within the bundle."
          },
          "role": {
            "type": "string",
            "description": "Semantic role: primary, attachment, telemetry, report, etc."
          },
          "hash_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "content_type": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      }
    },
    "notes": {
      "type": "string"
    }
  }
}
