import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AuthorizetypeLevelVO, AuthorizetypeLevelForm, AuthorizetypeLevelQuery } from '@/api/supplier/authorizetypeLevel/types';

/**
 * 查询供应商授权等级和授权类型列表
 * @param query
 * @returns {*}
 */

export const listAuthorizetypeLevel = (query?: AuthorizetypeLevelQuery): AxiosPromise<AuthorizetypeLevelVO[]> => {
  return request({
    url: '/system/authorizetypeLevel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商授权等级和授权类型详细
 * @param id
 */
export const getAuthorizetypeLevel = (id: string | number): AxiosPromise<AuthorizetypeLevelVO> => {
  return request({
    url: '/system/authorizetypeLevel/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商授权等级和授权类型
 * @param data
 */
export const addAuthorizetypeLevel = (data: AuthorizetypeLevelForm) => {
  return request({
    url: '/system/authorizetypeLevel',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商授权等级和授权类型
 * @param data
 */
export const updateAuthorizetypeLevel = (data: AuthorizetypeLevelForm) => {
  return request({
    url: '/system/authorizetypeLevel',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商授权等级和授权类型
 * @param id
 */
export const delAuthorizetypeLevel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/authorizetypeLevel/' + id,
    method: 'delete'
  });
};
