/**
 * 流量池管理
 */

/**
 * [real RD流量池列表]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function real() {
  return service.get('api/virtual/flow-pools/real');
}

/**
 * [packages 后向套餐列表]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function packages() {
  return service.get('api/virtual/flow-pools/packages');
}

/**
 * [index 流量池列表]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function index(data) {
  return service.get('api/virtual/flow-pools/index', {
    params: data
  });
}

/**
 * [exportList 流量池列表导出]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function exportList(data) {
  return service.get('api/virtual/flow-pools/export', {
    params: data
  });
}

/**
 * [show 流量池详情]
 * @param  {[type]} id [description]
 * @return {[type]}      [description]
 */
export function show(params) {
  return service.get('api/virtual/flow-pools/show', params);
}

/**
 * [exportDetail 流量池详情导出]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function exportDetail(data) {
  return service.get('api/virtual/flow-pools/detail/export', {
    params: data
  });
}

/**
 * [create 创建流量池]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function create(data) {
  return serviceForm.post('api/virtual/flow-pools/create', data);
}

/**
 * [update 修改流量池]
 * @param  {[type]} data [description]
 * @param  {[type]} id   [角色id]
 * @return {[type]}      [description]
 */
export function update(data, id) {
  return serviceForm.post(`api/virtual/flow-pools/update/${id}`, data);
}

/**
 * [destroy 删除流量池]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function destroy(data) {
  return service.post('api/virtual/flow-pools/destroy', data);
}

/**
 * [setting 流量池计费规则]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function setting(data) {
  return service.post('api/virtual/flow-pools/setting', data);
}

/**
 * [getFlows 数据生成]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function getFlows(data) {
  return service.get('api/virtual/flow-pools/flows', {
    params: data
  });
}

/**
 * [postFlows 数据生成]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function postFlows(data) {
  return service.post('api/virtual/flow-pools/flows', data);
}

/**
 * [import 属性导入]
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function importFlows(file) {
  let config = {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  };

  let params = new FormData();

  params.append('file', file);

  return service.post('api/virtual/flow-pools/import-flows', params, config);
}
