let pages: any = [];
let subPackages: any = [];
let tabBar: any = {};
let plugins: any;
let requiredPrivateInfos: any = [];
let singlePage: any = {};

if (process.env.TARO_ENV === 'weapp') {
  pages = [
    // 'pages/home/index',
    'pages/xpeng/index',
    // 'pages/driveNew/index',
    'pages/user/index',
    'pages/user/login',
    'pages/map/index',
  ];

  subPackages = [
    {
      root: 'robotaxi',
      pages: [
        'pages/demo/index',
      ],
    }
  ];

  tabBar = {
    position: 'bottom',
    color: '#B2B2B2',
    selectedColor: '#000000',
    backgroundColor: '#fff',
    borderStyle: 'white',
    custom: false,
    list: [
      // {
      //   pagePath: 'pages/home/index',
      //   text: '发现',
      //   iconPath: './assets/tabbar/tab_icon_home.png',
      //   selectedIconPath: './assets/tabbar/tab_icon_home_act.png',
      // },
      // {
      //   pagePath: 'pages/driveNew/index',
      //   text: '试驾',
      //   iconPath: './assets/tabbar/tab_icon_drive.png',
      //   selectedIconPath: './assets/tabbar/tab_icon_drive_act.png',
      // },
      {
        pagePath: 'pages/xpeng/index',
        text: '购车',
        iconPath: './assets/tabbar/tab_icon_buy.png',
        selectedIconPath: './assets/tabbar/tab_icon_buy_act.png',
      },
      {
        pagePath: 'pages/map/index',
        text: '充电',
        iconPath: './assets/tabbar/tab_icon_map.png',
        selectedIconPath: './assets/tabbar/tab_icon_map_act.png',
      },
      {
        pagePath: 'pages/user/index',
        text: '我的',
        iconPath: './assets/tabbar/tab_icon_mine.png',
        selectedIconPath: './assets/tabbar/tab_icon_mine_act.png',
      },
    ],
  };

  plugins = {
  };

  requiredPrivateInfos = [
    'getLocation',
  ];

  singlePage = {
    "navigationBarFit": "squeezed"
  };
}

const config: any = {
  pages,
  subPackages,

  window: {
    backgroundTextStyle: 'dark',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: ' ',
    navigationBarTextStyle: 'black',
    navigationStyle: 'default',  // custom
    // backgroundColorTop: '#f00'
    // renderingMode: 'seperated',
    // mixedRenderComponents: ['video', 'map', 'canvas'],
  },
  networkTimeout: {
    request: 60000,
    connectSocket: 60000,
    uploadFile: 60000,
    downloadFile: 60000,
  },
  debug: false,
  resizable: false,
  requiredBackgroundModes: [ 'audio' ],
  permission: {
    'scope.userLocation': {
      desc: '您的位置信息将用于定位就近的门店'
    }
  },
}

if (process.env.TARO_ENV !== 'jd') {
  config.tabBar = tabBar;
}

if (process.env.TARO_ENV === 'alipay') {
  config.window.allowsBounceVertical = 'NO';
}

if (plugins) {
  config.plugins = plugins;
}

if (requiredPrivateInfos) {
  config.requiredPrivateInfos = requiredPrivateInfos;
}

if (singlePage) {
  config.singlePage = singlePage;
}

export default config;
