import request from '@/config/axios'

// 供应商证件资质 VO
export interface CertificateVO {
  id: number // 主键
  supplierId: number // 供应商id
  type: string // 证件类型 字典表
  name: string // 证件名称
  urls: string // 附件 多个附件逗号分隔
}

// 供应商证件资质 API
export const CertificateApi = {
  // 查询供应商证件资质分页
  getCertificatePage: async (params: any) => {
    return await request.get({ url: `/supplier/certificate/page`, params })
  },

  // 查询供应商证件资质详情
  getCertificate: async (id: number) => {
    return await request.get({ url: `/supplier/certificate/get?id=` + id })
  },

  // 新增供应商证件资质
  createCertificate: async (data: CertificateVO) => {
    return await request.post({ url: `/supplier/certificate/create`, data })
  },

  // 修改供应商证件资质
  updateCertificate: async (data: CertificateVO) => {
    return await request.put({ url: `/supplier/certificate/update`, data })
  },

  // 删除供应商证件资质
  deleteCertificate: async (id: number) => {
    return await request.delete({ url: `/supplier/certificate/delete?id=` + id })
  },

  // 导出供应商证件资质 Excel
  exportCertificate: async (params) => {
    return await request.download({ url: `/supplier/certificate/export-excel`, params })
  },
}
