export interface SearchResultDoc {
  id: number,
  title: string;
  authors: string[];
  unit: string;
  keywords: string[];
  abstract: string;
  unit_scholar: {scholar_name: string, unit_name: string}[];
  cited?: number;
  year?: number;
  highlight?: Map<String, String>;
}

export interface SearchResult {
  aggs: any;
  total: number;
  docs: SearchResultDoc[];
  page?: number;
  size?: number;
}

export interface AggItem {
  key: string;
  count: number;
}

export type SearchType = 'simple' | 'advanced';

export interface Pagination {
  page: number;
  size: number;
}

export type Sort = 'Relevance' | 'DateDesc' | 'DateAsc' | 'CitedDesc';

export type ResultMode = 'brief' | 'detail';

export interface ChapterSearchRequest {
  from?: number;
  size?: number;
  reportName: string;
  reportKeywords: string;
  chapterKeywords: string[];
  queryKeywords?: string[];
  queryWithInKeywords?: string[];
}

export interface UnitScholar {
  unitName: string;
  unitScholarName: string;
  scholarName: string;
}

export interface ChapterSearchDocResponse {
  id: number;
  docId: number;
  score: number;
  filename: string;
  section: string;
  parentSearch: string;
  title: string;
  keywords: string[];
  content: string;
  unitScholars: UnitScholar[];
  year?: string;
  page: number;
  orderNum: number;
  journalName?: string;
}

export interface ChapterSearchResponse {
  total: number;
  items: ChapterSearchDocResponse[];
}
