import request from '@/axios'
import { REQUEST_BASE } from '@/constants'
import {
  designerSearch,
  designerData,
  staffCategoryData,
  jobsData,
  SalespersonData,
  staffGroupSearch,
  staffGroupData
} from './types'
export const getDesigner = (params: designerSearch): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/designer`, params })
}
export const getDesignerDetail = (id: number): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/designer/${id}` })
}
export const addDesigner = (data: designerData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/designer`, data })
}
export const delDesigner = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/designer/${id}` })
}
export const putDesigner = (data: designerData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/designer/${data.id}`, data })
}
export const getWorker = (params: designerSearch): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/worker`, params })
}
export const getWorkerDetail = (id: number): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/worker/${id}` })
}
export const addWorker = (data: designerData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/worker`, data })
}
export const delWorker = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/worker/${id}` })
}
export const putWorker = (data: designerData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/worker/${data.id}`, data })
}
export const getStaffCategory = (params: designerSearch): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/category`, params })
}
export const addStaffCategory = (data: staffCategoryData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/category`, data })
}
export const delStaffCategory = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/category/${id}` })
}
export const putStaffCategory = (data: staffCategoryData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/category/${data.id}`, data })
}
export const getStaffJobs = (params: { page?: number; limit?: number }): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/jobs`, params })
}
export const addStaffJobs = (data: jobsData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/jobs`, data })
}
export const delStaffJobs = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/jobs/${id}` })
}
export const putStaffJobs = (data: jobsData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/jobs/${data.id}`, data })
}
export const getStaffSalesperson = (params: {
  page?: number
  limit?: number
}): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/salesperson`, params })
}
export const getStaffSalespersonDetail = (id: number): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/salesperson/${id}` })
}
export const addStaffSalesperson = (data: SalespersonData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/salesperson`, data })
}
export const delStaffSalesperson = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/salesperson/${id}` })
}
export const putStaffSalesperson = (data: SalespersonData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/salesperson/${data.id}`, data })
}

export const getDesignerGroup = (params: staffGroupSearch): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/designer_group`, params })
}
export const addDesignerGroup = (data: staffGroupData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/designer_group`, data })
}
export const delDesignerGroup = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/designer_group/${id}` })
}
export const putDesignerGroup = (data: staffGroupData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/designer_group/${data.id}`, data })
}

export const getWorkerGroup = (params: staffGroupSearch): Promise<IResponse> => {
  return request.get({ url: `${REQUEST_BASE}/decoration/worker_group`, params })
}
export const addWorkerGroup = (data: staffGroupData): Promise<IResponse> => {
  return request.post({ url: `${REQUEST_BASE}/decoration/worker_group`, data })
}
export const delWorkerGroup = (id: number): Promise<IResponse> => {
  return request.delete({ url: `${REQUEST_BASE}/decoration/worker_group/${id}` })
}
export const putWorkerGroup = (data: staffGroupData): Promise<IResponse> => {
  return request.put({ url: `${REQUEST_BASE}/decoration/worker_group/${data.id}`, data })
}
