import { z } from 'zod';

export const KnowledgePointSchema = z.object({
  title: z.string().min(1).max(255),
  content: z.string().min(1).max(5000),
  summary: z.string().max(1000).optional(),
  tags: z.array(z.string().max(50)).max(10).default([]),
  difficulty: z.enum(['beginner', 'intermediate', 'advanced']).default('intermediate'),
  suggestedOrder: z.number().int().min(1).default(1),
});

export const KnowledgeImportResultSchema = z.object({
  knowledgePoints: z.array(KnowledgePointSchema).min(1).max(30),
  totalCount: z.number().int().min(1).max(30),
  sourceSummary: z.string().max(500).optional(),
});

export type KnowledgeImportResult = z.infer<typeof KnowledgeImportResultSchema>;

export const KNOWLEDGE_IMPORT_OUTPUT_SCHEMA_DESC = `{
  "knowledgePoints": [
    {
      "title": "什么是主动回忆",
      "content": "主动回忆是一种学习策略，指在不看材料的情况下主动检索记忆中的信息...",
      "summary": "主动回忆是从记忆中主动提取信息的学习方法",
      "tags": ["学习方法", "记忆", "认知科学"],
      "difficulty": "beginner",
      "suggestedOrder": 1
    }
  ],
  "totalCount": 5,
  "sourceSummary": "这段文本主要介绍了主动回忆学习法的原理和应用"
}`;
