{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aslice.sh/schematics/json/index-snapshot.schema.json",
  "title": "aslice index snapshot",
  "description": "Authenticated package records and recipe references. Resolve dependencies from verified recipe bundles; STATE-AND-RECOVERY \u00a71 and \u00a78.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "snapshot_version",
    "repository",
    "created",
    "packages",
    "identity",
    "environment"
  ],
  "properties": {
    "snapshot_version": {
      "type": "integer",
      "const": 1
    },
    "repository": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]*$",
      "description": "Namespace of the serving repository."
    },
    "created": {
      "type": "string",
      "format": "date-time"
    },
    "packages": {
      "type": "array",
      "items": {
        "$ref": "package-record.schema.json"
      }
    },
    "tombstones": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "final_version",
          "reason"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          },
          "final_version": {
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "type": "string",
            "enum": [
              "upstream-eol",
              "security",
              "renamed",
              "unmaintainable",
              "takedown",
              "other"
            ]
          },
          "replacement": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        }
      },
      "description": "Permanent; historical snapshots and old locks resolve forever (ORCHARD-POLICY \u00a78). Never delete the record."
    },
    "aliases": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]*$"
      },
      "propertyNames": {
        "pattern": "^[a-z0-9][a-z0-9-]*$"
      },
      "description": "Historical renames, so adopt --from-homebrew and old locks keep resolving (ORCHARD-POLICY \u00a73)."
    },
    "identity": {
      "type": "string",
      "minLength": 1
    },
    "environment": {
      "type": "string",
      "enum": [
        "dev",
        "staging",
        "prod"
      ]
    }
  }
}
