import { DATA_FORMAT, DATA_TYPE, FILTER_TYPE } from '../constant';

export interface ReportColumnConfigEntity {
  column: string;
  query: string;
  label: string;
  type: DATA_TYPE;
  format: DATA_FORMAT;
  date_format?: string;
}

export interface FilterConfigEntity {
  filter_column: string;
  filter_type: FILTER_TYPE;
  date_format?: string;
  filed_label: string;
  field_type: string;
  hide_field?: boolean;

  select_data_source_url?: string;
  select_custom_options?: string[];
  select_value_key?: string;
  select_label_key?: string;
}

export interface FilterPeriodConfigEntity {
  key: string;
  type: FILTER_TYPE;
  note?: string;
  hidden?: boolean;
}

export interface ReportConfigEntity {
  group_name: string;
  unique_name: string;
  label: string;

  table_schema: string;
  main_table_alias?: string;
  // customVirtualTableSchema?(
  //   filterModel: any,
  //   findQueryConfig: (column: string) => string,
  //   createFilterSql: (key: string, item: any) => string,
  // ): string;
  whereCondition?(filterModel: any): string[];
  whereDefaultConditions?: {
    column: string;
    filter_type: FILTER_TYPE;
    values: string[] | boolean[] | number[];
  }[];
  defaultOrderBy?: string[];
  lowLevelOrderBy?: string[];

  column_configs: ReportColumnConfigEntity[];
  filter_configs?: FilterConfigEntity[];
  filter_period_config?: FilterPeriodConfigEntity;
  ignore_filter_keys?: string[];
  customQueryColumn?(column: string): string;
}
