import { formatRouteForms } from 'src/utils/form';

export const formRoutes = {
  forms: (type: string) => `/${formatRouteForms(type)}`,
  form: {
    detail: (type: string, id: number | string) =>
      `${formRoutes.forms(type)}/${id}`,
    pdfDetail: (type: string, id: number | string) =>
      `${formRoutes.forms(type)}/pdf/${id}`,
    chat: (type: string, id: number | string) =>
      `${formRoutes.form.detail(type, id)}/chat`,
    approvalWorkflow: (type: string, id: number | string) =>
      `${formRoutes.form.detail(type, id)}/approval-workflow`,
    completed: (
      type: string,
      id: number | string,
      idCompleted: number | string,
    ) => `${formRoutes.form.detail(type, id)}/completed/${idCompleted}`,
    edit: (type: string, id: number | string, idCompleted: number | string) =>
      `${formRoutes.form.detail(type, id)}/edit/${idCompleted}`,
    pdfCompleted: (
      type: string,
      id: number | string,
      idCompleted: number | string,
    ) => `${formRoutes.form.pdfDetail(type, id)}/completed/${idCompleted}`,
  },
  requests: {
    general: (type: string) => `${formRoutes.forms(type)}/requests`,
    detail: (type: string, id: number | string) =>
      `${formRoutes.requests.general(type)}/${id}`,
    approvalWorkflow: (type: string, id: number | string) =>
      `${formRoutes.requests.detail(type, id)}/approval-workflow`,
  },
};

export const formSkeletonRoutes = {
  forms: (type: string) => `/${formatRouteForms(type)}`,
  form: {
    detail: (type: string) => `${formSkeletonRoutes.forms(type)}/:id`,
    pdfDetail: (type: string) => `${formSkeletonRoutes.forms(type)}/pdf/:id`,
    chat: (type: string) => `${formSkeletonRoutes.form.detail(type)}/chat`,
    approvalWorkflow: (type: string) =>
      `${formSkeletonRoutes.form.detail(type)}/approval-workflow`,
    completed: (type: string) =>
      `${formSkeletonRoutes.form.detail(type)}/completed/:idCompleted`,
    edit: (type: string) =>
      `${formSkeletonRoutes.form.detail(type)}/edit/:idCompleted`,
    pdfCompleted: (type: string) =>
      `${formSkeletonRoutes.form.pdfDetail(type)}/completed/:idCompleted`,
  },
  requests: {
    general: (type: string) => `${formSkeletonRoutes.forms(type)}/requests`,
    detail: (type: string) =>
      `${formSkeletonRoutes.requests.general(type)}/:id`,
    approvalWorkflow: (type: string) =>
      `${formSkeletonRoutes.requests.detail(type)}/approval-workflow`,
  },
};
