import defaultConfig, { adminViewConfig, adminConfig } from 'config/adminConfig';
import accountOptions from 'config/models/account';
import { treatList } from 'store/utils/reducers';

import * as zeus from './graphql-zeus';

export { zeus };

export const viewConfig = {
  ...adminViewConfig,
};

let env = 'staging';
if (defaultConfig.staging) env = 'staging';
if (defaultConfig.dev) env = 'dev';

console.log('env', env);

const urls = {
  app: {
    dev: 'https://oxaav8d1i7.execute-api.eu-central-1.amazonaws.com/dev/',
    staging: 'https://staging-api.work-in-flex.com/admin/',
  },
  upload: {
    dev: 'https://rmhhz2lgyi.execute-api.eu-central-1.amazonaws.com/staging/',
    staging: 'https://rmhhz2lgyi.execute-api.eu-central-1.amazonaws.com/staging/',
  },
};

export const config = {
  ...defaultConfig,
  accountOptions: {
    ...adminConfig.accountOptions,
    ...accountOptions,
  },
  // new language selector
  maxNumLanguagesDisplayed: 100,
  noActiveCampaign: true,
  noIntegrations: true,
  cmsMenu: [
    {
      title: 'Pages',
      link: '/cms/pages',
      icon: 'edit',
    },
    {
      title: 'Errors',
      link: '/cms/errors',
      icon: 'times',
    },
    {
      title: 'Lists',
      link: '/cms/lists',
      icon: 'list',
    },
  ],
  listEnum: [
    {
      label: 'Equipements',
      value: 'equipment',
    },
    {
      label: 'Caractéristiques',
      value: 'feature',
    },
  ],
  noCellUpdate: true,
  project: "Work'in flex",

  defaultLanguage: 'fr',
  subname: 'admin',
  storage: {
    name: 'workinflex-admin-storage',
    reducers: ['session'],
  },
  apollo: true,
  apolloFile: true,
  loginApollo: true,
  cmsApollo: true,
  cmsQueryName: 'pagesGetMany',

  defaultUrl: '/resource/users',
  contentPath: 'cms/pages',
  idKey: '_id',

  errorsPath: 'server.errors.',
  api: {
    baseUrlApollo: urls.app[env],
    uploadUrlApollo: urls.upload[env],
  },

  availableLanguages: ['en', 'fr', 'nl', 'de'],
  languages: [
    {
      value: 'en',
      label: 'English',
    },
    {
      value: 'fr',
      label: 'French',
    },
    {
      value: 'nl',
      label: 'Dutch',
    },
    {
      value: 'de',
      label: 'German',
    },
  ],
};

export const headerNav = [
  {
    title: 'Data',
    link: '/resource',
    to: '/resource/users',
    icon: {
      // left | right
      position: 'left',
      name: 'database',
    },
  },
  {
    noSideNav: true,
    title: 'Content',
    link: '/cms',
    to: '/cms/pages',
    icon: {
      position: 'left',
      name: 'edit',
    },
  },
  // {
  //   noSideNav: true,
  //   title: 'Lists',
  //   link: '/lists',
  //   to: '/lists',
  //   icon: {
  //     position: 'left',
  //     name: 'list',
  //   },
  // },
  {
    title: 'Settings',
    link: '/settings',
    to: '/settings',
    icon: {
      position: 'left',
      name: 'cogs',
    },
  },
];

export const nav = [
  {
    title: 'Users',
    link: '/resource/users',
  },
];

export const stats = {};

export const constants = {};

export default config;
