// src/api/mes/hw/hadrwareType.ts
import request from '@/config/axios'

export interface HardwareTypeVO {
  id?: number
  parentTypeId?: number
  hardwareTypeCode: string
  hardwareTypeName: string
  enableFlag?: string
  remark?: string
  createBy?: string
  createTime?: Date
  updateBy?: string
  updateTime?: Date
}

export interface PageParam {
  pageNo: number
  pageSize: number
  hardwareTypeCode?: string
  hardwareTypeName?: string
  enableFlag?: string
}

// 查询硬件类型列表
export const listHardwareType = async (params: PageParam) => {
  return await request.get({ url: '/iscs/hardware-type/getHardwareTypePage', params })
}

// 获取硬件类型详细信息
export const getHardwareTypeInfo = async (id: number) => {
  return await request.get({ url: '/iscs/hardware-type/selectHardwareTypeById', params: { id } })
}

// 新增硬件类型
export const addHardwareType = async (data: HardwareTypeVO) => {
  return await request.post({ url: '/iscs/hardware-type/insertHardwareType', data })
}

// 修改硬件类型
export const updateHardwareType = async (data: HardwareTypeVO) => {
  return await request.put({ url: '/iscs/hardware-type/updateHardwareType', data })
}

// 删除硬件类型
export const delHardwareType = async (id: number) => {
  return await request.delete({
    url: '/iscs/hardware-type/deleteHardwareTypeList',
    params: { ids: id }
  })
}
