/**
 * Full document detail — flat structure matching backend DocumentDetail schema.
 *
 * Backend: GET /api/v1/document/{doc_id}
 */
/** 关联文件 */
export interface RelatedDoc {
  doc_id: string
  title: string
  relation_type: '正文' | '附件'
}

export interface DocumentDetail {
  doc_id: string
  content_hash: string
  title: string
  doc_number?: string
  issuing_org?: string
  doc_type?: string
  knowledge_category?: string
  subject_words: string[]
  signer?: string
  publish_date?: string
  summary?: string
  chunk_count: number
  page_count: number
  file_path?: string
  file_type?: string
  related_docs?: RelatedDoc[]
  created_at?: string
  updated_at?: string
}

/**
 * A document version sharing the same content_hash.
 *
 * Backend: GET /api/v1/document/versions/{content_hash}
 */
export interface DocumentVersion {
  doc_id: string
  title: string
  doc_number?: string
  issuing_org?: string
  doc_type?: string
  publish_date?: string
  signer?: string
}

export interface VersionListResponse {
  content_hash: string
  versions: DocumentVersion[]
  total: number
}

/**
 * A document reference cited by the research (深度研究) answer.
 *
 * Backend: ResearchReference in app/api/schemas/research.py
 */
export interface ResearchReference {
  doc_id: string
  title: string
  doc_number?: string
  relevance_score?: number
  source_group?: string
  source_label?: string
  strength?: 'high' | 'medium' | 'low'
  summary?: string
  profile_id?: string
  matched_fields?: string[]
  matched_field_labels?: string[]
  matched_chunks?: import('./search').MatchedChunk[]
}
