{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "vaultfire.pilot-scope-registry.v2.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schemaVersion",
    "status",
    "network",
    "chainId",
    "sourceCommit",
    "openSpecSha256",
    "generatedRouteInventorySha256",
    "deploymentManifestSha256",
    "routes"
  ],
  "properties": {
    "$schema": {
      "const": "../schemas/pilot-scope-registry.schema.json"
    },
    "schemaVersion": {
      "const": "2.0.0"
    },
    "status": {
      "enum": [
        "unconfigured",
        "candidate-bound-approved"
      ]
    },
    "network": {
      "const": "base"
    },
    "chainId": {
      "const": 8453
    },
    "sourceCommit": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9a-f]{40}$"
    },
    "openSpecSha256": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9a-f]{64}$"
    },
    "generatedRouteInventorySha256": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9a-f]{64}$"
    },
    "deploymentManifestSha256": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9a-f]{64}$"
    },
    "routes": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "routeId",
          "generatedRouteId",
          "routeMethod",
          "routePath",
          "module",
          "actionClass",
          "moduleSourcePath",
          "requiredDeploymentContract",
          "rolloutStageId",
          "protectedDecisionInfluence",
          "status",
          "privacyPortabilityImplementationPath",
          "privacyPortabilityImplementationSha256",
          "privacyPortabilityImplementationGitBlob",
          "privacyPortabilityInterfaceId"
        ],
        "properties": {
          "routeId": {
            "type": "string",
            "pattern": "^base\\.[a-z0-9]+(?:-[a-z0-9]+)*\\.read-only-query$"
          },
          "module": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9]{2,63}$"
          },
          "generatedRouteId": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "routeMethod": {
            "enum": [
              "GET"
            ]
          },
          "routePath": {
            "type": "string",
            "pattern": "^/api/v3/[A-Za-z0-9_:/.-]+$"
          },
          "actionClass": {
            "const": "read-only-query"
          },
          "moduleSourcePath": {
            "type": "string",
            "pattern": "^v3-src/contracts/[a-z0-9._/-]+\\.sol$"
          },
          "requiredDeploymentContract": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9]{2,63}$"
          },
          "rolloutStageId": {
            "type": "string",
            "pattern": "^stage:[0-9a-f]{64}$"
          },
          "protectedDecisionInfluence": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "enum": [
                "access",
                "collateral",
                "custody",
                "disputes",
                "eligibility",
                "pricing",
                "principal",
                "routing",
                "settlement",
                "slashing"
              ]
            }
          },
          "status": {
            "const": "candidate-bound-approved"
          },
          "privacyPortabilityImplementationPath": {
            "const": "v3-src/privacy-portability/canonical_api.py"
          },
          "privacyPortabilityImplementationSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "privacyPortabilityImplementationGitBlob": {
            "type": "string",
            "pattern": "^[0-9a-f]{40}$"
          },
          "privacyPortabilityInterfaceId": {
            "const": "vaultfire.privacy-portability.cli-v1"
          }
        }
      }
    }
  }
}
