import { FindOptions } from "sequelize";
import { Criteria } from "./critera";

export type CriteriaMappings = { [key: string]: string };
export type ConvertParams = { mappings?: CriteriaMappings; searchableFields?: string[] } & Record<
  string,
  unknown
>;

export interface ICriteriaToOrmConverter {
  convert(criteria: Criteria, params: ConvertParams): FindOptions;
  applyFilters(options: FindOptions, criteria: Criteria, mappings: CriteriaMappings): void;
  applyQuickSearch(options: FindOptions, criteria: Criteria, params: ConvertParams): void;
  applyOrder(options: FindOptions, criteria: Criteria, mappings: CriteriaMappings): void;
  applyPagination(options: FindOptions, criteria: Criteria): void;
}
