import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QualificationVO, QualificationForm, QualificationQuery } from '@/api/supplier/qualification/types';

/**
 * 查询供应商资质信息列表
 * @param query
 * @returns {*}
 */

export const listQualification = (query?: QualificationQuery): AxiosPromise<QualificationVO[]> => {
  return request({
    url: '/customer/qualification/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商资质信息详细
 * @param id
 */
export const getQualification = (id: string | number): AxiosPromise<QualificationVO> => {
  return request({
    url: '/customer/qualification/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商资质信息
 * @param data
 */
export const addQualification = (data: QualificationForm) => {
  return request({
    url: '/customer/qualification',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商资质信息
 * @param data
 */
export const updateQualification = (data: QualificationForm) => {
  return request({
    url: '/customer/qualification',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商资质信息
 * @param id
 */
export const delQualification = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/qualification/' + id,
    method: 'delete'
  });
};
