// 用户类型
export interface User {
  id: string
  email: string
  name?: string
  avatarUrl?: string
  role: 'user' | 'admin'
}

// 项目类型
export interface Project {
  id: string
  userId: string
  name: string
  description: string
  conversationCount: number
  createdAt: string
  updatedAt: string
}

// 会话类型
export interface Conversation {
  id: string
  userId: string
  projectId?: string
  agentId: string
  title: string
  modelName: string
  messageCount: number
  totalTokens: number
  createdAt: string
  updatedAt: string
}

// 消息类型
export interface Message {
  id: string
  conversationId: string
  role: 'user' | 'assistant'
  content: string
  metadata?: {
    kbReferences?: string[]
    citations?: any[]
    modelParams?: any
  }
  tokens?: number
  isPinned: boolean
  createdAt: string
}

// 知识库类型
export interface KnowledgeBase {
  id: string
  userId: string
  name: string
  description?: string
  difyDatasetId: string
  fileCount: number
  totalSizeBytes: number
  createdAt: string
  updatedAt: string
}

// 文档类型
export interface Document {
  id: string
  kbId: string
  userId: string
  filename: string
  fileType: string
  fileSizeBytes: number
  fileUrl: string
  difyDocumentId: string
  status: 'uploading' | 'processing' | 'completed' | 'failed'
  progress: number
  errorMessage?: string
  segmentsCount?: number
  tokensCount?: number
  uploadedAt: string
  processedAt?: string
  // Phase 2: 全文阅读模式新增字段
  extractionMethod?: string  // pymupdf/nougat/mammoth/direct
  extractionQuality?: number // 0-1质量分数
  charCount?: number         // 字符数
  language?: string          // 检测到的语言
  extractedText?: string     // 提取的文本内容
}

// API响应类型
export interface ApiResponse<T = any> {
  success: boolean
  data: T
  message?: string
}




