{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zhiyong-dev/json-schema/zhiyong-dev-search-response-schema.json",
  "title": "SearchResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zhiyong-dev-openapi.json#/components/schemas/SearchResponse",
  "type": "object",
  "required": [
    "mode",
    "query",
    "results",
    "retrieval"
  ],
  "properties": {
    "mode": {
      "type": "string",
      "const": "kg-rag-semantic"
    },
    "query": {
      "type": "string"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Entity"
      }
    },
    "retrieval": {
      "type": "object",
      "additionalProperties": true,
      "description": "Semantic retrieval diagnostics plus decisionIntent. Private evidence and raw article URLs are omitted."
    },
    "graph": {
      "$ref": "#/$defs/KnowledgeGraphProjection"
    }
  },
  "$defs": {
    "DecisionDimension": {
      "type": "object",
      "required": [
        "status",
        "values"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "known",
            "unknown",
            "not_applicable",
            "needs_verification"
          ]
        },
        "values": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "condition": {
                "type": "string"
              }
            }
          }
        },
        "knownValueCount": {
          "type": "integer"
        },
        "verificationValueCount": {
          "type": "integer"
        }
      }
    },
    "DecisionProfile": {
      "type": "object",
      "description": "Comparable selection dimensions. An absent value is unknown, not a negative claim.",
      "required": [
        "schemaVersion",
        "dimensions",
        "readiness"
      ],
      "properties": {
        "schemaVersion": {
          "type": "integer"
        },
        "dimensions": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/DecisionDimension"
          }
        },
        "readiness": {
          "$ref": "#/$defs/Readiness"
        }
      }
    },
    "Entity": {
      "type": "object",
      "required": [
        "id",
        "slug",
        "name",
        "kind",
        "decisionProfile"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "nameEn": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "decisionProfile": {
          "$ref": "#/$defs/DecisionProfile"
        }
      }
    },
    "GraphEdge": {
      "type": "object",
      "required": [
        "id",
        "source",
        "target",
        "relation"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "target": {
          "type": "string"
        },
        "relation": {
          "type": "string"
        },
        "relationLabel": {
          "type": "string"
        }
      }
    },
    "GraphNode": {
      "type": "object",
      "description": "A public KG node. contextOnly=true means it is relationship context, not a recommendation.",
      "required": [
        "id",
        "name",
        "kind",
        "contextOnly"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "nameEn": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "contextOnly": {
          "type": "boolean"
        }
      }
    },
    "KnowledgeGraphProjection": {
      "type": "object",
      "description": "A bounded KG subgraph projected around the returned candidates.",
      "required": [
        "schemaVersion",
        "status",
        "nodes",
        "edges",
        "resultNodeIds",
        "contextNodeIds"
      ],
      "properties": {
        "schemaVersion": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "enum": [
            "ready",
            "empty",
            "unavailable"
          ]
        },
        "projection": {
          "type": "string"
        },
        "nodes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GraphNode"
          }
        },
        "edges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GraphEdge"
          }
        },
        "resultNodeIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "contextNodeIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "seeds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "truncated": {
          "type": "boolean"
        }
      }
    },
    "Readiness": {
      "type": "object",
      "required": [
        "score",
        "level",
        "knownDimensions",
        "unknownDimensions",
        "needsVerificationDimensions"
      ],
      "properties": {
        "score": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "level": {
          "type": "string",
          "enum": [
            "ready",
            "partial",
            "insufficient"
          ]
        },
        "knownDimensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "unknownDimensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "needsVerificationDimensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "notApplicableDimensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}