export interface KnowledgeBase {
  id: string
  name: string
  kbType: 'product' | 'faq' | 'script' | 'policy' | 'general'
  description?: string
  priority: number
  isEnabled: boolean
  docCount: number
  createdAt: string
  updatedAt: string
}

export interface KnowledgeBaseCreate {
  name: string
  kb_type: 'product' | 'faq' | 'script' | 'policy' | 'general'
  description?: string
  priority?: number
}

export interface KnowledgeBaseUpdate {
  name?: string
  kb_type?: 'product' | 'faq' | 'script' | 'policy' | 'general'
  description?: string
  priority?: number
  is_enabled?: boolean
}

export interface KnowledgeBaseListResponse {
  data: KnowledgeBase[]
}

export interface Document {
  docId: string
  kbId: string
  fileName: string
  status: string
  jobId?: string
  createdAt: string
  updatedAt: string
}

export interface DocumentListResponse {
  data: Document[]
  pagination: {
    page: number
    pageSize: number
    total: number
    totalPages: number
  }
}

export interface IndexJob {
  jobId: string
  docId: string
  status: 'pending' | 'processing' | 'completed' | 'failed'
  progress: number
  errorMsg?: string
}

export const KB_TYPE_OPTIONS = [
  { value: 'product', label: '产品知识', color: 'primary' },
  { value: 'faq', label: '常见问题', color: 'success' },
  { value: 'script', label: '话术库', color: 'warning' },
  { value: 'policy', label: '政策法规', color: 'danger' },
  { value: 'general', label: '通用知识', color: 'info' }
]

export const KB_TYPE_MAP: Record<string, { label: string; color: string }> = {
  product: { label: '产品知识', color: 'primary' },
  faq: { label: '常见问题', color: 'success' },
  script: { label: '话术库', color: 'warning' },
  policy: { label: '政策法规', color: 'danger' },
  general: { label: '通用知识', color: 'info' }
}
