import { request } from '@/utils/request'
import { Base } from '@/enums/api'
import {
  StaffListResParams,
  StaffListReqParams,
  ModifyStaffReqParams,
  AddStaffReqParams,
  StaffRoleListResParams
} from '@/types/staff'

/**
 * 获取员工列表
 * @param params
 * @returns
 */
export const getStaffList = (params: StaffListReqParams) => {
  return request.post<StaffListResParams>({
    url: Base.CFG_STAFF_LIST,
    data: params
  })
}

/**
 * 修改员工信息
 * @param params
 * @returns
 */
export const modifyStaff = (params: ModifyStaffReqParams) => {
  return request.post<BaseResParams>({
    url: Base.CFG_STAFF_MODIFY,
    data: params
  })
}

/**
 * 删除员工
 * @param id
 * @returns
 */
export const removeStaff = (id: string) => {
  return request.post<BaseResParams>({
    url: Base.CFG_STAFF_REMOVE,
    data: { id }
  })
}

/**
 * 添加员工
 * @param params
 * @returns
 */
export const addStaff = (params: AddStaffReqParams) => {
  return request.post<BaseResParams>({
    url: Base.CFG_STAFF_ADD,
    data: params
  })
}

/**
 * 获取员工职位列表
 * @returns
 */
export const getStaffRoleList = () => {
  return request.post<StaffRoleListResParams>({
    url: Base.CFG_STAFF_ROLES,
    data: {}
  })
}
