'use strict';
const { merge } = require('webpack-merge');

const values = {
  NODE_ENV: '"production"',
  HEP_URL: JSON.stringify(process.env.HEP_URL),
  MATOMO_HOST: JSON.stringify(process.env.MATOMO_HOST),
  MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID),
  LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL),
  VUE_APP_FLAVOR: JSON.stringify(process.env.APP_FLAVOR),
  /*
   * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code,
   * and JS needs quotes around strings
   * see https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code
   */
  VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL,

  /*
   * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes
   */
  // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv
  VUE_APP_FAVICON_32: '/static/favicon-32x32.png',
  VUE_APP_FAVICON_16: '/static/favicon-16x16.png',
  VUE_APP_TITLE: 'mySkillbox',
  // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^
};

switch (process.env.APP_FLAVOR) {
  case 'my-kv':
    module.exports = merge(values, require('./prod-my-kv.env.js'));
    break;
  case 'my-dhf':
    module.exports = merge(values, require('./prod-dhf.env.js'));
    break;
  case 'my-dha':
    module.exports = merge(values, require('./prod-dha.env.js'));
    break;
  default:
    // we are on the skillbox APP_FLAVOR
    module.exports = values;
}
