import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysAgentSetVO, SysAgentSetForm, SysAgentSetQuery } from '@/api/system/sysAgentSet/types';

/**
 * 查询代理后台设置列表
 * @param query
 * @returns {*}
 */

export const listSysAgentSet = (query?: SysAgentSetQuery): AxiosPromise<SysAgentSetVO[]> => {
  return request({
    url: '/system/sysAgentSet/list',
    method: 'get',
    params: query
  });
};

export const getAgentSetData = (): AxiosPromise<SysAgentSetVO> => {
  return request({
    url: '/system/sysAgentSet/getAgentSetData',
    method: 'get'
  });
};

/**
 * 查询代理后台设置详细
 * @param id
 */
export const getSysAgentSet = (id: string | number): AxiosPromise<SysAgentSetVO> => {
  return request({
    url: '/system/sysAgentSet/' + id,
    method: 'get'
  });
};

/**
 * 新增代理后台设置
 * @param data
 */
export const addSysAgentSet = (data: SysAgentSetForm) => {
  return request({
    url: '/system/sysAgentSet',
    method: 'post',
    data: data
  });
};

/**
 * 修改代理后台设置
 * @param data
 */
export const updateSysAgentSet = (data: SysAgentSetForm) => {
  return request({
    url: '/system/sysAgentSet',
    method: 'put',
    data: data
  });
};

/**
 * 删除代理后台设置
 * @param id
 */
export const delSysAgentSet = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/sysAgentSet/' + id,
    method: 'delete'
  });
};
