import request from '@/config/axios'

export interface CriticalComponentVO {
  id: number
  code: string
  name: string
  description?: string
  remark?: string
  createTime?: string
}

export const CriticalComponentApi = {
  getCriticalComponentPage: async (params: any) => {
    return await request.get({ url: `/mes/critical-component/page`, params })
  },
  getCriticalComponentList: async () => {
    return await request.get({ url: `/mes/critical-component/list`, })
  },
  createCriticalComponent: async (data: Partial<CriticalComponentVO>) => {
    return await request.post({ url: `/mes/critical-component/create`, data })
  },

  updateCriticalComponent: async (data: Partial<CriticalComponentVO>) => {
    return await request.put({ url: `/mes/critical-component/update`, data })
  },

  deleteCriticalComponent: async (ids: string) => {
    return await request.delete({ url: `/mes/critical-component/delete?ids=` + ids })
  },

  exportCriticalComponent: async (params: any) => {
    return await request.download({ url: `/mes/critical-component/export-excel`, params })
  },

  importCriticalComponentTemplate: async () => {
    return await request.download({ url: `/mes/critical-component/get-import-template` })
  },

  exportDeviceComponent: async (params: any) => {
    return await request.download({ url: `/mes/critical-component/export-device-component`, params })
  }
}
