{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/huggingbay-xyz/json-schema/huggingbay-xyz-run-card-discovery-schema.json",
  "title": "RunCardDiscovery",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/huggingbay-xyz-openapi.json#/components/schemas/RunCardDiscovery",
  "type": "object",
  "required": [
    "schemaVersion",
    "artifactId",
    "state",
    "matchClaim",
    "note",
    "cards"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": "hugging-bay.run-card-discovery.v1"
    },
    "artifactId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 240
    },
    "state": {
      "type": "string",
      "enum": [
        "available",
        "unavailable"
      ]
    },
    "matchClaim": {
      "const": "artifact-only"
    },
    "note": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "required": [
            "summary"
          ],
          "properties": {
            "summary": {
              "type": "string"
            },
            "downloadable": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "cards": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "object",
        "required": [
          "id",
          "decisionId",
          "task",
          "taskMode",
          "rig",
          "runtime",
          "fit",
          "smoke",
          "representation",
          "evidenceCutoff",
          "expiresAt",
          "links"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^hbrc_[a-f0-9]{32}([a-f0-9]{32})?$"
          },
          "decisionId": {
            "type": "string",
            "pattern": "^hbd_[a-f0-9]{32}([a-f0-9]{32})?$"
          },
          "task": {
            "type": "string"
          },
          "taskMode": {
            "type": [
              "string",
              "null"
            ]
          },
          "rig": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "profileDigest"
            ],
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "profileDigest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "runtime": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "adapterId",
              "engineVersion",
              "adapterVersion"
            ],
            "properties": {
              "adapterId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "engineVersion": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "adapterVersion": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "fit": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "verdict",
              "evidenceLevel",
              "requiredBytes",
              "headroomBytes"
            ],
            "properties": {
              "verdict": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "evidenceLevel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "requiredBytes": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "headroomBytes": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "smoke": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "passed",
              "passedAt",
              "suiteId"
            ],
            "properties": {
              "passed": {
                "type": "boolean"
              },
              "passedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "suiteId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "representation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "artifactId",
              "representationId",
              "revision",
              "selectedFilesDigest"
            ],
            "properties": {
              "artifactId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "representationId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "revision": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "selectedFilesDigest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "evidenceCutoff": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "html",
              "json"
            ],
            "properties": {
              "html": {
                "type": "string"
              },
              "json": {
                "type": "string"
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "summary"
                    ],
                    "properties": {
                      "summary": {
                        "type": "string"
                      },
                      "downloadable": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "noteMessage": {
                "type": "string",
                "description": "Original route note, when a public qualification occupies note."
              }
            }
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "required": [
                  "summary"
                ],
                "properties": {
                  "summary": {
                    "type": "string"
                  },
                  "downloadable": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "noteMessage": {
            "type": "string",
            "description": "Original route note, when a public qualification occupies note."
          }
        }
      }
    },
    "noteMessage": {
      "type": "string",
      "description": "Original route note, when a public qualification occupies note."
    }
  }
}