import { AxiosResponse } from 'axios';

import { CATEGORY_IDS_TO_HIDE } from 'src/constants/courses';
import { CourseCategory } from 'src/pages/dashboard/learning/courses/types';

import { PaginatedResponse } from './pagination';

export const filterCourseCategories = (
  response: AxiosResponse<PaginatedResponse<CourseCategory>>,
) => {
  const filteredCategories = response.data.items.filter(
    category => !CATEGORY_IDS_TO_HIDE.includes(category.id),
  );

  return {
    ...response,
    data: { ...response.data, items: filteredCategories },
  };
};
