{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Grid-DB Training Sample",
  "description": "训练数据湖样本格式",
  "type": "object",
  "required": ["schema_version", "sample_id", "source_session", "dev_id", "persona_id", "created_at", "turns"],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0"
    },
    "sample_id": {
      "type": "string",
      "description": "唯一样本 ID"
    },
    "source_session": {
      "type": "string",
      "description": "来源 session_id"
    },
    "dev_id": {
      "type": "string",
      "pattern": "^DEV-[0-9]{3}$"
    },
    "persona_id": {
      "type": "string",
      "pattern": "^PER-[A-Z]{2,4}[0-9]{3}$"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "turns": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["role", "content"],
        "properties": {
          "role": {
            "type": "string",
            "enum": ["developer", "persona", "system"]
          },
          "content": { "type": "string" },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      }
    },
    "labels": {
      "type": "object",
      "properties": {
        "topic": { "type": "string" },
        "quality": { "type": "string", "enum": ["high", "medium", "low"] },
        "persona_style_match": { "type": "boolean" },
        "teaching_effectiveness": { "type": "integer", "minimum": 0, "maximum": 10 }
      }
    },
    "curated": {
      "type": "boolean",
      "default": false
    }
  }
}
