import RoleType, { isPlatForm } from './role.config';
const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre';
const environment = 'sc';

const envAPi = {
  api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
  kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
  kdspApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
  goodsApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
  querysApi: `https://sc-merchant-api-${environment}.liangkebang.net/admin/merchant/sc-settlement`,
  prologueDomain: `https://mall-${environment}.liangkebang.net`,
  qiniuHost: 'https://kdspstatic.q-gp.com/',
  opapiHost: `https://gw.yxmie.com`,
  wsApi: `wss://push-${environment}.liangkebang.net`,
  msgApi: `https://msgapi-${environment}.liangkebang.net`,
  roleApi: isPlatForm
    ? `https://sc-op-api-${environment}.liangkebang.net`
    : `https://sc-merchant-api-${environment}.liangkebang.net`,
};

const prodApi = {
  api: '//security.q-gp.com',
  kdspOpApi: '//kdsp-operation.q-gp.com',
  prologueDomain: '//mall.q-gp.com',
  kdspApi: 'https://sc-merchant-api.q-gp.com',
  // goodsApi: 'https://sc-op-api.q-gp.com', // 测试环境打包域名，
  goodsApi: 'https://sc-merchant-api.q-gp.com', // 线上环境打包域名
  qiniuHost: 'https://kdspstatic.q-gp.com/',
  //  talos  后面要下线
  opapiHost: '//gw.yxmie.com',
  // opapiHost: 'https://opapi.q-gp.com',
  // querysApi: 'https://sc-settlement-api.q-gp.com',
  querysApi: 'https://sc-merchant-api.q-gp.com/admin/merchant/sc-settlement',
  wsApi: 'wss://push.q-gp.com',
  msgApi: 'https://msgapi.q-gp.com',
  roleApi: isPlatForm ? 'https://sc-op-api.q-gp.com' : 'https://sc-merchant-api-pre.q-gp.com',
};

const preProdApi = {
  api: '//backstms-pre.xyqb.com',
  kdspOpApi: '//kdsp-operation-pre.q-gp.com',
  prologueDomain: '//mall.q-gp.com',
  kdspApi: '//sc-op-api-pre.q-gp.com',
  goodsApi: 'https://sc-merchant-api-pre.q-gp.com',
  qiniuHost: 'https://kdspstatic.q-gp.com/',
  opapiHost: 'https://opapi-pre.q-gp.com',
  querysApi: 'https://sc-settlement-api.q-gp.com',
  wsApi: 'wss://push.q-gp.com',
  msgApi: 'https://msgapi.q-gp.com',
  roleApi: isPlatForm ? 'https://sc-op-api-pre.q-gp.com' : 'https://sc-merchant-api-pre.q-gp.com',
};

let json = envAPi;
if (isPre) {
  json = preProdApi;
} else if (isProduction) {
  json = prodApi;
}
const exportApi = Object.assign({}, RoleType, json);
// module.exports = exportApi;

// let exportApi;
// isProduction ? (exportApi = prodApi) : (exportApi = envAPi);

export default exportApi;
