import request from './request';
let api = {
  getChannelAdConfig: '/Program/Index/getChannelAdConfig'
};
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'
};
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 };
  }
}

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

export default {
  getChannelAdConfig
};
