/**
 * @flow
 */

import React from 'react';

export type ENV_TYPE = 'DEV' | 'FT' | 'SIT' | 'UAT' | 'PRO'

//export const ENV = 'DEV'      // 预留的DEV,地址和SIT相同
export const ENV = 'SIT'
//export const ENV = 'UAT'
//export const ENV = 'PRO'

//默认路由
export const initialRouteName = 'TabPage'
export const RootPageInitialName = 'HomePage'

// 最后更新日期,用于在‘关于’页面显示
export const ppkVersion = '1'

export const baseCoreURLMapping = {
  DEV: 'http://58.49.129.4/sit',

  SIT: 'http://58.49.129.4/sit',
  UAT: 'http://58.49.129.4',
  PRO: 'https://ecustomer.cntaiping.com',
}

export const htmlURLMapping = {
  DEV: 'http://smarket.tp95589.com',

  SIT: 'http://smarket.tp95589.com',
  UAT: 'http://smarket.tp95589.com',
  PRO: 'http://mall.itaiping.com',
}

export const staticResourceMapping = {
  DEV: 'http://58.49.129.4/sit',

  SIT: 'http://58.49.129.4/sit',
  UAT: 'http://58.49.129.4',
  PRO: 'https://ecustomer.cntaiping.com',
}


export const resourceURLMapping = {
  DEV: `${staticResourceMapping.DEV}/static/rn/src/img/`,

  SIT: `${staticResourceMapping.UAT}/static/rn/src/img/`,
  UAT: `${staticResourceMapping.UAT}/static/rn/src/img/`,
  PRO: `${staticResourceMapping.PRO}/static/rn/src/img/`,
}

export const wxUserNameMapping = {
  DEV: 'gh_b0cac2def4b1',
  SIT: 'gh_b0cac2def4b1',
  UAT: 'gh_b0cac2def4b1',
  PRO: 'gh_104e2261b2fc',
}

export function updateInfoURL(env?: ENV_TYPE = ENV) {
  return `${staticResourceMapping[String(env)]}/rn/updateIXX.json?ver=${Math.random()}`
}

export const StoreContext = React.createContext({});

export const appFileDir = () => 'com.basic';
