{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://theloopbreaker.com/schemas/v3-x402/discovery.v1.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "schemaVersion",
    "protocolVersion",
    "x402Version",
    "releaseMode",
    "readiness",
    "generatedAt",
    "endpoints",
    "bazaar",
    "settlement",
    "safety"
  ],
  "properties": {
    "schema": {
      "const": "vaultfire.v3.x402.discovery.v1"
    },
    "schemaVersion": {
      "const": "1.0.0"
    },
    "protocolVersion": {
      "const": "3.0.0"
    },
    "x402Version": {
      "const": 2
    },
    "releaseMode": {
      "const": "read-only-fail-closed-v1"
    },
    "readiness": {
      "const": "limited"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "endpoints": {
      "type": "array",
      "minItems": 20,
      "maxItems": 20,
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "method",
          "path",
          "canonicalSdkRoute",
          "disposition",
          "readOnly",
          "deploymentRequired",
          "responseSchema",
          "responseStatuses",
          "description",
          "free",
          "version",
          "contractStatus",
          "requestSchema",
          "idempotencyRule",
          "finality",
          "dataSource",
          "privacy",
          "availability"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9-]+$"
          },
          "method": {
            "enum": [
              "GET",
              "POST"
            ]
          },
          "path": {
            "type": "string",
            "pattern": "^/api/v3/"
          },
          "canonicalSdkRoute": {
            "type": [
              "string",
              "null"
            ]
          },
          "disposition": {
            "enum": [
              "supported",
              "degraded",
              "unavailable",
              "retired"
            ]
          },
          "readOnly": {
            "const": true
          },
          "deploymentRequired": {
            "type": "boolean"
          },
          "responseSchema": {
            "type": "string",
            "pattern": "^https://theloopbreaker.com/schemas/v3-x402/"
          },
          "responseStatuses": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "enum": [
                200,
                400,
                404,
                503
              ]
            }
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "free": {
            "const": true
          },
          "version": { "const": "v3" },
          "contractStatus": { "const": "read-only" },
          "requestSchema": { "const": "empty#" },
          "idempotencyRule": { "const": "none" },
          "finality": {
            "const": "soft"
          },
          "dataSource": {
            "const": "computed"
          },
          "privacy": {
            "enum": ["public", "restricted"]
          },
          "availability": {
            "enum": [
              "available",
              "fail-closed",
              "retired"
            ]
          }
        }
      }
    },
    "bazaar": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publicationState",
        "indexingVerified",
        "indexedResourceCount",
        "v3CandidateCount",
        "publicationGate"
      ],
      "properties": {
        "publicationState": {
          "const": "not-published"
        },
        "indexingVerified": {
          "const": false
        },
        "indexedResourceCount": {
          "const": 0
        },
        "v3CandidateCount": {
          "const": 0
        },
        "publicationGate": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "schema",
            "schemaVersion",
            "candidateCount",
            "eligible",
            "listingReceiptIds",
            "deploymentEvidenceIds",
            "required",
            "capabilityEvidenceSatisfied",
            "coherentBundleRequired"
          ],
          "properties": {
            "schema": {
              "const": "vaultfire.v3.x402.publication-gate.v1"
            },
            "schemaVersion": {
              "const": "1.0.0"
            },
            "candidateCount": {
              "const": 0
            },
            "eligible": {
              "const": false
            },
            "listingReceiptIds": {
              "type": "array",
              "maxItems": 0
            },
            "deploymentEvidenceIds": {
              "type": "array",
              "maxItems": 0
            },
            "required": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "items": {
                "type": "string"
              }
            },
            "capabilityEvidenceSatisfied": {
              "const": false
            },
            "coherentBundleRequired": {
              "const": true
            }
          }
        }
      }
    },
    "settlement": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "enabled",
        "evidenceVerified",
        "receiptStore",
        "realV3AddressVerified"
      ],
      "properties": {
        "enabled": {
          "const": false
        },
        "evidenceVerified": {
          "const": false
        },
        "receiptStore": {
          "const": "read-only-status-boundary"
        },
        "realV3AddressVerified": {
          "const": false
        }
      }
    },
    "safety": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "autoWalletConnection",
        "autoSign",
        "autoPay",
        "v2Fallback",
        "missionSensitiveDecisionInputs"
      ],
      "properties": {
        "autoWalletConnection": {
          "const": false
        },
        "autoSign": {
          "const": false
        },
        "autoPay": {
          "const": false
        },
        "v2Fallback": {
          "const": false
        },
        "missionSensitiveDecisionInputs": {
          "const": "retired-or-fail-closed"
        }
      }
    }
  }
}
