{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://git-a2a.com/schema/a2amodule-lock.v2.json",
  "title": "a2amodule schema 2 lock",
  "type": "object",
  "required": ["schema", "dependencies"],
  "properties": {
    "schema": { "const": 2 },
    "dependencies": {
      "type": "object",
      "propertyNames": { "$ref": "#/$defs/id" },
      "additionalProperties": { "$ref": "#/$defs/lockedDependency" }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "id": { "type": "string", "pattern": "^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$" },
    "relativePath": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(?!/)(?![A-Za-z]:[\\\\/])(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!\\.$).+$"
    },
    "lockedAgent": {
      "type": "object",
      "required": ["declaredCard", "card", "commit"],
      "properties": {
        "name": { "type": "string" },
        "declaredCard": { "type": "string", "minLength": 1 },
        "card": { "type": "string", "minLength": 1 },
        "commit": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
      },
      "additionalProperties": false
    },
    "binding": {
      "type": "object",
      "required": ["adapter", "variant"],
      "properties": {
        "adapter": { "type": "string", "minLength": 1 },
        "variant": { "type": "string", "minLength": 1 },
        "export": { "type": "string", "minLength": 1 },
        "path": { "$ref": "#/$defs/relativePath" }
      },
      "additionalProperties": false
    },
    "lockedDependency": {
      "type": "object",
      "required": ["component", "git", "ref", "commit", "manifest", "bindings", "agent"],
      "properties": {
        "component": { "$ref": "#/$defs/id" },
        "git": { "type": "string", "minLength": 1 },
        "ref": { "type": "string", "minLength": 1 },
        "path": { "$ref": "#/$defs/relativePath" },
        "commit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "manifest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
        "bindings": { "type": "array", "items": { "$ref": "#/$defs/binding" } },
        "agent": { "$ref": "#/$defs/lockedAgent" },
        "surface": { "$ref": "#/$defs/relativePath" }
      },
      "additionalProperties": false
    }
  }
}
