import request from '@/config/axios'

// 物资柜查询参数
export interface CabinetQuery {
  current: number
  size: number
  cabinetName?: string
  cabinetCode?: string
  status?: number
}

// 物资柜表单对象
export interface CabinetVO {
  cabinetId?: number
  cabinetName: string
  cabinetCode: string
  cabinetType: string
  cabinetIcon?: string
  cabinetPicture?: string
  status: number
  remark?: string
  createTime?: Date
}

// 查询物资柜列表
export const listMaterialsCabinet = async (params: CabinetQuery) => {
  return await request.get({ url: '/iscs/materials-cabinet/getMaterialsCabinetPage', params })
}

// 查询物资柜详情
export const getMaterialsCabinetInfo = async (id: number) => {
  return await request.get({
    url: '/iscs/materials-cabinet/selectMaterialsCabinetById',
    params: { id: id }
  })
}

// 新增物资柜
export const addMaterialsCabinet = async (data: CabinetVO) => {
  return await request.post({ url: '/iscs/materials-cabinet/insertMaterialsCabinet', data })
}

// 修改物资柜
export const updateMaterialsCabinet = async (data: CabinetVO) => {
  return await request.put({ url: '/iscs/materials-cabinet/updateMaterialsCabinet', data })
}

// 删除物资柜
export const deleteMaterialsCabinet = async (ids: number) => {
  return await request.delete({
    url: '/iscs/materials-cabinet/deleteMaterialsCabinetList?ids='+ids,
  })
}
