import type {
  AutoCorrect, ContentItem, ContentFilter, ContentSortType, DidYouMean, Sort, BaseParams,
  PaginationParams, SearchParams
} from './common/mod.ts';


export type ContentSearchOrigin = 'ORGANIC' | 'DID_YOU_MEAN' | 'UNDO_AUTO_CORRECT';

export interface ContentSearchPageParams extends BaseParams, PaginationParams, SearchParams {
  /** The origin of the content search request */
  origin?: ContentSearchOrigin;
  /** Changes how content items are sorted in the response */
  sort?: ContentSortType;
}

export interface ContentSearchPageBody {
  /**
   * Configure the search result by specifying contentFilter, to only
   * include a subset of content items in the result.
   */
  primaryList?: {
    contentFilter: ContentFilter;
  };
}

export interface ContentSearchPage {
  q: string;
  primaryList: PrimaryContentList;
  didYouMean: DidYouMean[];
  autoCorrect?: AutoCorrect;
}

export interface PrimaryContentList {
  sort: Sort<ContentSortType>;
  items: ContentItem[];
  totalHits: number;
}
