import request from '@/config/axios'

// 证书 VO
export interface CertificateVO {
  id: number // id
  nameCn: string // 证书中文名称
  nameEn: string // 证书英文名称
  parentId: number // 上级id
  level: boolean // 层级
}

// 证书 API
export const CertificateApi = {
  // 查询证书分页
  getCertificatePage: async (params: any) => {
    return await request.get({ url: `/menduner/system/certificate/page`, params })
  },

  // 查询证书详情
  getCertificate: async (id: number) => {
    return await request.get({ url: `/menduner/system/certificate/get?id=` + id })
  },

  // 新增证书
  createCertificate: async (data: CertificateVO) => {
    return await request.post({ url: `/menduner/system/certificate/create`, data })
  },

  // 修改证书
  updateCertificate: async (data: CertificateVO) => {
    return await request.put({ url: `/menduner/system/certificate/update`, data })
  },

  // 删除证书
  deleteCertificate: async (id: number) => {
    return await request.delete({ url: `/menduner/system/certificate/delete?id=` + id })
  },

  // 导出证书 Excel
  exportCertificate: async (params) => {
    return await request.download({ url: `/menduner/system/certificate/export-excel`, params })
  }
}