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

export class AdminActionsFilter extends GlobalSearchFilter {
  _filter: {
    search: StringTypeFilter;
    lastName: StringTypeFilter;
    firstName: StringTypeFilter;
    middleName: StringTypeFilter;
    event: OptionTypeFilter;
    dateFrom: DateTypeFilter;
    dateTo: DateTypeFilter;
    status: OptionTypeFilter;
  } = {
    search: {
      type: FILTER_TYPE.string,
      value: '',
    },
    lastName: {
      type: FILTER_TYPE.string,
      value: '',
    },
    firstName: {
      type: FILTER_TYPE.string,
      value: '',
    },
    middleName: {
      type: FILTER_TYPE.string,
      value: '',
    },
    event: {
      type: FILTER_TYPE.option,
      value: [],
      options: [
        {
          value: 'create',
          label: 'Создание',
        },
        {
          value: 'update',
          label: 'Обновление',
        },
        {
          value: 'delete',
          label: 'Удаление',
        },
      ],
    },
    status: {
      type: FILTER_TYPE.option,
      value: [],
      options: [
        {
          value: 'SUCCESS',
          label: 'Успешно',
        },
        {
          value: 'FAILED',
          label: 'Не успешно',
        },
      ],
    },
    dateFrom: {
      type: FILTER_TYPE.date,
      value: null,
    },
    dateTo: {
      type: FILTER_TYPE.date,
      value: null,
    },
  };

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

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

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

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

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

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

  get event(): OptionTypeFilter['value'] {
    return this._filter.event.value;
  }

  set event(value: OptionTypeFilter['value']) {
    this._filter.event.value = value;
  }

  get status(): OptionTypeFilter['value'] {
    return this._filter.status.value;
  }

  set status(value: OptionTypeFilter['value']) {
    this._filter.status.value = value;
  }

  get eventOptions(): OptionTypeFilter['value'] {
    return this._filter.event.options;
  }

  get statusOptions(): OptionTypeFilter['value'] {
    return this._filter.status.options;
  }

  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;
  }
}
