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

export const ActivityeRepository = {
  getActivities: () => api.get(`/api/task/activities`),
  createActivity: (data) => api.post("/users", data),
  updateActivity: (id, data) => api.put(`/users/${id}`, data),
  deleteActivity: (id) => api.delete(`/users/${id}`),
};

export const RolesRepository = {
  getRoles: () => api.get(`/api/employee/roles`),
  createRoles: (data) => api.post("/users", data),
  updateRoles: (id, data) => api.put(`/users/${id}`, data),
  deleteRoles: (id) => api.delete(`/users/${id}`),

  getEmployeeRoles: (id) => api.get(`/api/employee/roles/${id}`),
  createEmployeeRoles: (data) => api.post("/api/roles/assign-roles", data),
};

export const MasterRespository = {
  getRoles: () => api.get("/api/roles"),
  createRole: (data) => api.post("/api/roles", data),
  updateRoles: (id, data) => api.put(`/api/roles/${id}`, data),
  getFeatures: () => api.get(`/api/feature`),

  createJobRole: (data) => api.post("api/roles/jobrole", data),
  getJobRole: () => api.get("/api/roles/jobrole"),
  updateJobRole: (id, data) => api.put(`/api/roles/jobrole/${id}`, data),

  getActivites: () => api.get("api/master/activities"),
  createActivity: (data) => api.post("api/master/activity", data),
  updateActivity: (id, data) =>
    api.post(`api/master/activity/edit/${id}`, data),
  getIndustries: () => api.get("api/master/industries"),

  // delete
  "Job Role": (id) => api.delete(`/api/roles/jobrole/${id}`),
  Activity: (id) => api.delete(`/api/master/activity/delete/${id}`),
  "Application Role": (id) => api.delete(`/api/roles/${id}`),
  "Work Category": (id) => api.delete(`api/master/work-category/${id}`),
  "Contact Category": (id) => api.delete(`/api/master/contact-category/${id}`),
  "Contact Tag": (id) => api.delete(`/api/master/contact-tag/${id}`),
  "Expense Type": (id, isActive) =>
    api.delete(`/api/Master/expenses-type/delete/${id}`, (isActive = false)),
  "Payment Mode": (id, isActive) =>
    api.delete(`/api/Master/payment-mode/delete/${id}`, (isActive = false)),
  "Expense Status": (id, isActive) =>
    api.delete(`/api/Master/expenses-status/delete/${id}`, (isActive = false)),

  getWorkCategory: () => api.get(`/api/master/work-categories`),
  createWorkCategory: (data) => api.post(`/api/master/work-category`, data),
  updateWorkCategory: (id, data) =>
    api.post(`/api/master/work-category/edit/${id}`, data),

  getContactCategory: () => api.get(`/api/master/contact-categories`),
  createContactCategory: (data) =>
    api.post(`/api/master/contact-category`, data),
  updateContactCategory: (id, data) =>
    api.post(`/api/master/contact-category/edit/${id}`, data),

  getContactTag: () => api.get(`/api/master/contact-tags`),
  createContactTag: (data) => api.post(`/api/master/contact-tag`, data),
  updateContactTag: (id, data) =>
    api.post(`/api/master/contact-tag/edit/${id}`, data),

  getAuditStatus: () => api.get("/api/Master/work-status"),

  getExpenseType: () => api.get("/api/Master/expenses-types"),
  createExpenseType: (data) => api.post("/api/Master/expenses-type", data),
  updateExpenseType: (id, data) =>
    api.put(`/api/Master/expenses-type/edit/${id}`, data),

  getPaymentMode: () => api.get("/api/Master/payment-modes"),
  createPaymentMode: (data) => api.post(`/api/Master/payment-mode`, data),
  updatePaymentMode: (id, data) =>
    api.put(`/api/Master/payment-mode/edit/${id}`, data),

  getExpenseStatus: () => api.get("/api/Master/expenses-status"),
  createExpenseStatus: (data) => api.post("/api/Master/expenses-status", data),
  updateExepnseStatus: (id, data) =>
    api.put(`/api/Master/expenses-status/edit/${id}`, data),
};
