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 = {
  getMasterMenus: () => api.get("/api/AppMenu/get/master-list"),

  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),

  //Services
  getService: () => api.get("api/master/service/list"),
  createService: (data) => api.post("api/master/service/create", data),
  updateService: (id, data) => api.put(`api/master/service/edit/${id}`, data),
  Services: (id) => api.delete(`/api/master/service/delete/${id}`),

  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-category/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)),
  "Document Type": (id) => api.delete(`/api/Master/document-type/delete/${id}`),
  "Document Category": (id) =>
    api.delete(`/api/Master/document-category/delete/${id}`),
  "Payment Adjustment Head": (id, isActive) =>
    api.delete(
      `/api/Master/payment-adjustment-head/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"),

  getExpenseCategories: () => api.get("/api/Master/expenses-categories"),
  createExpenseCategory: (data) =>
    api.post("/api/Master/expenses-category", data),
  updateExpenseCategory: (id, data) =>
    api.put(`/api/Master/expenses-category/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),

  getDocumentCategories: (entityType) =>
    api.get(
      `/api/Master/document-category/list${
        entityType ? `?entityTypeId=${entityType}` : ""
      }`
    ),
  createDocumenyCategory: (data) =>
    api.post(`/api/Master/document-category`, data),
  updateDocumentCategory: (id, data) =>
    api.put(`/api/Master/document-category/edit/${id}`, data),

  getDocumentTypes: (category) =>
    api.get(
      `/api/Master/document-type/list${
        category ? `?documentCategoryId=${category}` : ""
      }`
    ),

  createDocumentType: (data) => api.post(`/api/Master/document-type`, data),
  updateDocumentType: (id, data) =>
    api.put(`/api/Master/document-type/edit/${id}`, data),

  getGlobalServices: () => api.get("/api/Master/global-service/list"),
  getMasterServices: () => api.get("/api/Master/service/list"),
  getActivityGrops: (serviceId) =>
    api.get(`/api/Master/activity-group/list?serviceId=${serviceId}`),
  createActivityGroup: (data) =>
    api.post(`/api/Master/activity-group/create`, data),
  updateActivityGrop: (serviceId, data) =>
    api.put(`/api/Master/activity-group/edit/${serviceId}`, data),
  getActivitesByGroup: (activityGroupId) =>
    api.get(`api/master/activities?activityGroupId=${activityGroupId}`),
  deleteActivityGroup: (id) =>
    api.delete(`/api/Master/activity-group/delete/${id}`),

  deleteActivity: (id) => api.delete(`/api/Master/activity/delete/${id}`),

  getOrganizationType: () => api.get("/api/Master/organization-type/list"),

  getPaymentAdjustmentHead: (isActive) =>
    api.get(`/api/Master/payment-adjustment-head/list?isActive=${isActive}`),
  createPaymentAjustmentHead: (data) =>
    api.post(`/api/Master/payment-adjustment-head`, data),
  updatePaymentAjustmentHead: (id, data) =>
    api.put(`/api/Master/payment-adjustment-head/edit/${id}`, data),

  getCurrencies: () => api.get(`/api/Master/currencies/list`),

  getRecurringStatus: () => api.get(`/api/Master/recurring-status/list`),
  // Service Job JobTickets Status
  getJobStatus: (statusId,projectId) =>
    api.get(
      `/api/Master/job-status/list?statusId=${statusId}&projectId=${projectId}`
    ),

  getTeamRole: () => api.get(`/api/Master/team-roles/list`),


  getInvoiceAttachmentTypes:()=>api.get("/api/Master/invoice-attachment-type/list")
};
