import {
  DateTypeFilter,
  FILTER_TYPE,
  GlobalSearchFilter,
  StringTypeFilter,
} from '@/recruits/utils/global-search-filter';

export const INITIAL_PAGINATION = {
  sortBy: 'date',
  descending: true,
  page: 1,
  rowsPerPage: 10,
  rowsNumber: 1000,
};
export class VersionSearchFilter extends GlobalSearchFilter {
  _filter: {
    search: StringTypeFilter;
    initiator: StringTypeFilter;
    diffPath: StringTypeFilter;
    dateFrom: DateTypeFilter;
    dateTo: DateTypeFilter;
  } = {
    search: {
      type: FILTER_TYPE.string,
      value: '',
    },
    initiator: {
      type: FILTER_TYPE.string,
      value: '',
    },
    diffPath: {
      type: FILTER_TYPE.string,
      value: '',
    },
    dateFrom: {
      type: FILTER_TYPE.date,
      value: null,
    },
    dateTo: {
      type: FILTER_TYPE.date,
      value: null,
    },
  };

  get initiator(): StringTypeFilter['value'] {
    return this._filter.initiator.value;
  }

  set initiator(value: StringTypeFilter['value']) {
    this._filter.initiator.value = value;
  }

  get diffPath(): StringTypeFilter['value'] {
    return this._filter.diffPath.value;
  }

  set diffPath(value: StringTypeFilter['value']) {
    this._filter.diffPath.value = value;
  }

  get dateFrom(): DateTypeFilter['value'] {
    return this._filter.dateFrom.value;
  }

  set dateFrom(value: DateTypeFilter['value']) {
    this._filter.dateFrom.value = value;
  }

  get dateTo(): DateTypeFilter['value'] {
    return this._filter.dateTo.value;
  }

  set dateTo(value: DateTypeFilter['value']) {
    this._filter.dateTo.value = value;
  }
}
