import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QualificationFileVO, QualificationFileForm, QualificationFileQuery } from '@/api/supplier/qualificationFile/types';

/**
 * 查询供应商授权信息文件列表
 * @param query
 * @returns {*}
 */

export const listQualificationFile = (query?: QualificationFileQuery): AxiosPromise<QualificationFileVO[]> => {
  return request({
    url: '/customer/qualificationFile/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商授权信息文件详细
 * @param id
 */
export const getQualificationFile = (id: string | number): AxiosPromise<QualificationFileVO> => {
  return request({
    url: '/customer/qualificationFile/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商授权信息文件
 * @param data
 */
export const addQualificationFile = (data: QualificationFileForm) => {
  return request({
    url: '/customer/qualificationFile',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商授权信息文件
 * @param data
 */
export const updateQualificationFile = (data: QualificationFileForm) => {
  return request({
    url: '/customer/qualificationFile',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商授权信息文件
 * @param id
 */
export const delQualificationFile = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/qualificationFile/' + id,
    method: 'delete'
  });
};
