import { coursesRoutes } from '../courses/routes';
import { pathsRoutes } from '../paths/routes';

import useIds from './useIds';

const useRoutes = () => {
  const { pathId } = useIds();

  return {
    paths: {
      list: pathsRoutes.base,
      detail: pathsRoutes.detail,
      completion: pathsRoutes.completion,
    },
    courses: {
      list: coursesRoutes.base,
      detail: pathId
        ? pathsRoutes.courses(pathId).detail
        : coursesRoutes.detail,
      lesson: pathId
        ? pathsRoutes.courses(pathId).lesson
        : coursesRoutes.lesson,
      completion: pathId
        ? pathsRoutes.courses(pathId).completion
        : coursesRoutes.completion,
      sign: pathId ? pathsRoutes.courses(pathId).sign : coursesRoutes.sign,
    },
  };
};

export default useRoutes;
