import api from 'src/config/api';

export const loginUser = (userId, password) =>
  api.get<any>('/external-endpoints/9', {
    params: {
      EmployeeNumber: userId,
      EmployeePassword: password,
    },
  });

export const getEmployeeData = userId =>
  api.get<any>('/external-endpoints/8', {
    params: {
      employeeId: userId,
    },
  });

export const getEmployeeSones = userId =>
  api.get<any>('/external-endpoints/10', {
    params: {
      EmployeeId: userId,
    },
  });

export const getPlants = () => api.get<any>('/external-endpoints/22');

export const getAreas = plantId =>
  api.get<any>('/external-endpoints/23', {
    params: {
      PlantId: plantId,
    },
  });

export const getSupervisors = areaId =>
  api.get<any>('/external-endpoints/24', {
    params: {
      AreaId: areaId,
    },
  });

export const getFAQs = () => api.get<any>('/external-endpoints/16');

export const getProductsList = () => api.get<any>('/external-endpoints/18');

export const getEmployeeIdeas = (userId, startDate, endDate) =>
  api.get<any>('/external-endpoints/11', {
    params: {
      employeeId: userId,
      StartDate: startDate,
      EndDate: endDate,
    },
  });

export const getIdeaDetails = ideaId =>
  api.get<any>('/external-endpoints/12', {
    params: {
      IdeaID: ideaId,
    },
  });

export const getEmployeeTransactions = (userId, startDate, endDate) =>
  api.get<any>('/external-endpoints/17', {
    params: {
      EmployeeId: userId,
      StartDate: startDate,
      EndDate: endDate,
    },
  });

export const createIdea = values =>
  api.post<any>('/external-endpoints/13', values);

export const uploadFile = values =>
  api.post<any>('/external-endpoints/25', values);

export const addEmployee = values =>
  api.post<any>('/external-endpoints/26', values);

export const getIdeasApprovals = userId =>
  api.get<any>('/external-endpoints/27', {
    params: {
      EmployeeID: userId,
    },
  });

export const getEmployeesData = folio =>
  api.get<any>('/external-endpoints/28', {
    params: {
      folio: folio,
    },
  });

export const getCurrentApprover = folio =>
  api.get<any>('/external-endpoints/29', {
    params: {
      Folio: folio,
    },
  });

export const getUploadedFiles = folio =>
  api.get<any>('/external-endpoints/30', {
    params: {
      folio: folio,
      moduleID: 1,
    },
  });

export const editData = values =>
  api.post<any>('/external-endpoints/31', values, {
    params: {
      id: values.folio,
    },
  });

export const setApprovalStatus = values =>
  api.post<any>('/external-endpoints/32', values);
