import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SupplierauthorizeVO, SupplierauthorizeForm, SupplierauthorizeQuery } from '@/api/supplier/supplierauthorize/types';

/**
 * 查询供应能力查询列表
 * @param query
 * @returns {*}
 */

export const listSupplierauthorize = (query?: SupplierauthorizeQuery): AxiosPromise<SupplierauthorizeVO[]> => {
  return request({
    url: '/customer/supplierauthorize/getSupplyCapacityList',
    method: 'get',
    params: query
  });
};

/**
 * 查询授权详情列表（新接口）
 * @param query
 * @returns {*}
 */
export const getAuthorizeDetailList = (query?: SupplierauthorizeQuery): AxiosPromise<SupplierauthorizeVO[]> => {
  return request({
    url: '/customer/supplierauthorize/getscmDetailList',
    method: 'get',
    params: query
  });
};

/**
 * 获取品牌授权详情（编辑回显用）
 * @param id
 */
export const getBrandAuthorizeDetail = (id: string | number): AxiosPromise<SupplierauthorizeVO> => {
  return request({
    url: '/customer/supplierauthorize/getBrandAuthorizeDetail',
    method: 'get',
    params: { id }
  });
};


/**
 * 查询供应能力查询详细
 * @param id
 */
export const getSupplierauthorize = (id: string | number): AxiosPromise<SupplierauthorizeVO> => {
  return request({
    url: '/customer/supplierauthorize/' + id,
    method: 'get'
  });
};

/**
 * 新增供应能力查询
 * @param data
 */
export const addSupplierauthorize = (data: SupplierauthorizeForm) => {
  return request({
    url: '/customer/supplierauthorize',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应能力查询
 * @param data
 */
export const updateSupplierauthorize = (data: SupplierauthorizeForm) => {
  return request({
    url: '/customer/supplierauthorize',
    method: 'put',
    data: data
  });
};

/**
 * 审核
 * @param data
 */
export const examSupplierauthorize = (data: SupplierauthorizeForm) => {
  return request({
    url: '/customer/supplierauthorize/exam',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应能力查询
 * @param id
 */
export const delSupplierauthorize = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/supplierauthorize/' + id,
    method: 'delete'
  });
};
