import request from '@/config/axios'

export interface MaterialGroupVO {
  id?: number
  name: string
  parentId: number
  status: number
  sort: number
  createTime: Date
}

// 查询物料组（精简)列表
export const getSimpleMaterialGroupList = async (): Promise<MaterialGroupVO[]> => {
  return await request.get({ url: '/rq/iot-material-group/simple-list' })
}

// 查询物料组列表
export const getMaterialGroupPage = async (params: PageParam) => {
  return await request.get({ url: '/rq/iot-material-group/list', params })
}

// 查询物料组详情
export const getMaterialGroup = async (id: number) => {
  return await request.get({ url: '/rq/iot-material-group/get?id=' + id })
}

// 新增物料组
export const createMaterialGroup = async (data: MaterialGroupVO) => {
  return await request.post({ url: '/rq/iot-material-group/create', data: data })
}

// 修改物料组
export const updateMaterialGroup = async (params: MaterialGroupVO) => {
  return await request.put({ url: '/rq/iot-material-group/update', data: params })
}

// 删除物料组
export const deleteMaterialGroup = async (id: number) => {
  return await request.delete({ url: '/rq/iot-material-group/delete?id=' + id })
}
