{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capcard.ai/schema/v1/capability_card.schema.json",
  "title": "Capability Card v1.0.0",
  "description": "Machine-verifiable capability profile for the agent economy.",
  "type": "object",
  "required": ["capcard_version", "name", "version", "capabilities", "benchmarks"],
  "additionalProperties": true,
  "properties": {
    "capcard_version": { "type": "string" },
    "id":              { "type": "string" },
    "name":            { "type": "string" },
    "type":            { "type": "string", "enum": ["library", "service", "model", "dataset", "tool"] },
    "description":     { "type": "string" },
    "version":         { "type": "string" },
    "license":         { "type": "string" },
    "homepage":        { "type": "string", "format": "uri" },
    "repository":      { "type": "string", "format": "uri" },
    "authors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string" },
          "role": { "type": "string" }
        }
      }
    },
    "capabilities": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "name", "status"],
        "properties": {
          "id":          { "type": "string" },
          "name":        { "type": "string" },
          "category":    { "type": "string" },
          "description": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["proven", "proven_constructive", "proven_analytic", "empirically_confirmed", "experimental", "conjecture"]
          },
          "constraints":  { "type": "object" },
          "tags": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "benchmarks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name"],
        "properties": {
          "id":             { "type": "string" },
          "name":           { "type": "string" },
          "capability_ref": { "type": "string" },
          "metric":         { "type": "string" },
          "value":          {},
          "unit":           { "type": "string" },
          "direction":      { "type": "string", "enum": ["lower_is_better", "higher_is_better"] },
          "environment":    { "type": "object" },
          "reproducibility": {
            "type": "object",
            "properties": {
              "command":       { "type": "string" },
              "deterministic": { "type": "boolean" },
              "source_file":   { "type": "string" }
            }
          }
        }
      }
    },
    "proofs": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "status"],
        "properties": {
          "id":               { "type": "string" },
          "name":             { "type": "string" },
          "statement":        { "type": "string" },
          "status":           { "type": "string" },
          "proof_method":     { "type": "string" },
          "capability_refs":  { "type": "array", "items": { "type": "string" } },
          "verified_by":      { "type": "array" }
        }
      }
    },
    "verification": {
      "type": "object",
      "properties": {
        "test_count":     { "type": "integer" },
        "test_pass_rate": { "type": "number", "minimum": 0, "maximum": 1 },
        "last_verified":  { "type": "string" },
        "commit_hash":    { "type": "string" },
        "trust_score": {
          "type": "object",
          "properties": {
            "value":   { "type": "number", "minimum": 0, "maximum": 1 },
            "version": { "type": "string" },
            "method":  { "type": "string" }
          }
        }
      }
    },
    "integration": { "type": "object" },
    "extensions":  { "type": "object" },
    "metadata":    { "type": "object" }
  }
}
