import { api } from "../utils/axiosClient";

const EmployeeRepository = {
  getAllEmployeeList: (showInactive) =>
    api.get(`api/employee/list?showInactive=${showInactive}`),
  getEmployeeListByproject: (projectid) =>
    api.get(`/api/employee/list/${projectid}`),
  searchEmployees: (query) => api.get(`/api/employee/search/${query}`),
  manageEmployee: (data) => api.post("/api/employee/manage", data),
  updateEmployee: (id, data) => api.put(`/users/${id}`, data),
  // deleteEmployee: ( id ) => api.delete( `/users/${ id }` ),
  getEmployeeProfile: (id) => api.get(`/api/employee/profile/get/${id}`),
  deleteEmployee: (id) => api.delete(`/api/employee/${id}`),
 getEmployeeName: (projectId, search) => {
  const params = new URLSearchParams();

  if (projectId) params.append("projectId", projectId);
  if (search) params.append("searchString", search);

  const query = params.toString();
  return api.get(`/api/Employee/basic${query ? `?${query}` : ""}`);
}

};

export default EmployeeRepository;
