{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://theloopbreaker.com/schemas/v3-x402/contract-result.v1.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "schemaVersion",
    "protocolVersion",
    "route",
    "name",
    "data"
  ],
  "properties": {
    "schema": {
      "const": "vaultfire.v3.contract-result.v1"
    },
    "schemaVersion": {
      "const": "1.0.0"
    },
    "protocolVersion": {
      "const": "3.0.0"
    },
    "route": {
      "const": "/api/v3/contracts/:name"
    },
    "name": {
      "type": "string",
      "minLength": 2
    },
    "data": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "name",
            "module",
            "disposition",
            "deployment",
            "address",
            "sourceAvailable",
            "executableEvidenceAvailable",
            "reason"
          ],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 2
            },
            "module": {
              "type": "string",
              "minLength": 1
            },
            "disposition": {
              "enum": [
                "supported",
                "deferred",
                "retired"
              ]
            },
            "deployment": {
              "enum": [
                "unconfigured",
                "not-in-pilot",
                "prohibited"
              ]
            },
            "address": {
              "type": "null"
            },
            "sourceAvailable": {
              "type": "boolean"
            },
            "executableEvidenceAvailable": {
              "const": false
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "message",
        "retryable"
      ],
      "properties": {
        "code": {
          "type": "string",
          "minLength": 1
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "retryable": {
          "type": "boolean"
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "data": {
            "type": "null"
          }
        }
      },
      "then": {
        "required": [
          "error"
        ]
      }
    }
  ]
}
