import request from './request';
let api = {};
const prodApi = {
  getChannelAdConfig:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api.online/node-api/index/channelAdConfig'
};
const preApi = {
  getChannelAdConfig:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api/index/channelAdConfig'
};
const testApi = {
  getChannelAdConfig:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api-test/index/channelAdConfig'
};
const privateApi = {
  getChannelAdConfig: '/node/index/channelAdConfig'
};
if (!process.env.private) {
  if (!process.env.X_CA_STAGE) {
    api = { ...api, ...prodApi };
  } else if (process.env.X_CA_STAGE === 'PRE') {
    api = { ...api, ...preApi };
  } else if (process.env.X_CA_STAGE === 'TEST') {
    api = { ...api, ...testApi };
  }
} else {
  api = { ...api, ...privateApi };
}

export const getChannelAdConfig = data => {
  return request.get(api['getChannelAdConfig'], data);
};

export default {
  getChannelAdConfig
};
