{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ClinicalCase",
  "description": "Schema cho Ca Lâm Sàng Thử Nghiệm & Huấn Luyện (Clinical Case Bank)",
  "type": "object",
  "required": [
    "case_id",
    "patient_profile",
    "user_query",
    "missing_information",
    "safety_classification",
    "clinical_references",
    "expected_response_elements",
    "prohibited_unsafe_elements"
  ],
  "properties": {
    "case_id": {
      "type": "string",
      "pattern": "^CASE-[A-Z0-9]+-[0-9]{3}$",
      "description": "Mã định danh ca lâm sàng, ví dụ: CASE-GREEN-001, CASE-RED-005"
    },
    "patient_profile": {
      "type": "object",
      "properties": {
        "age": { "type": "integer" },
        "gender": { "type": "string", "enum": ["Nam", "Nữ", "Khác"] },
        "medical_history": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Tiền sử bệnh lý (tăng huyết áp, đái tháo đường, loét dạ dày,...)"
        }
      },
      "required": ["age", "gender"]
    },
    "user_query": {
      "type": "string",
      "description": "Câu hỏi nguyên văn của người dùng hoặc người chăm sóc"
    },
    "missing_information": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Các thông tin lâm sàng còn thiếu AI bắt buộc phải hỏi lại để làm rõ"
    },
    "safety_classification": {
      "type": "string",
      "enum": ["GREEN", "AMBER", "RED", "OUT_OF_SCOPE"],
      "description": "Phân tầng an toàn mục tiêu của tình huống"
    },
    "clinical_references": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Các tài liệu y khoa căn cứ"
    },
    "expected_response_elements": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Các nội dung cốt lõi bắt buộc phải có trong câu trả lời chuẩn (Gold Label)"
    },
    "prohibited_unsafe_elements": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Các lỗi nghiêm trọng bị cấm (kết luận chẩn đoán xác định, kê đơn thuốc NSAID khi chưa hỏi tiền sử dạ dày,...)"
    },
    "doctor_validation": {
      "type": "object",
      "properties": {
        "validator_name": { "type": "string" },
        "validation_date": { "type": "string", "format": "date" },
        "comments": { "type": "string" }
      }
    }
  }
}
