import AppSettings from '@/config/app-settings'

const BASE_URL = AppSettings.evo.enable
  ? 'https://evo-elken-com.s3-ap-southeast-1.amazonaws.com/live/member_portal'
  : 'https://s3-ap-southeast-1.amazonaws.com/nibsprod/member_portal'

const ibsLinkDictionary = new Map([
  ['TOA', BASE_URL + '/tnc/T_C-{isoCode}.pdf'],
  ['RNR', BASE_URL + '/member_rnr/MemberRnR-{isoCode}.pdf'],
  ['SHIPPING', BASE_URL + '/shipping_tnc/shipping_tnc.pdf'],
  ['RENTAL_TOA', BASE_URL + '/rental_terms/EKSMART-RT-{isoCode}.pdf'],
])

const evoLinkDictionary = new Map([
  ['RNR', BASE_URL + '/rnr/rules-regulations-{isoCode}.pdf'],
  ['TOA', BASE_URL + '/tnc/terms-agreement-{isoCode}.pdf'],
  ['SHIPPING', BASE_URL + '/shipping_tnc/shipping-terms-conditions.pdf'],
  ['RENTAL_TOA', BASE_URL + '/rental_terms/eksmart-rental-terms-{isoCode}.pdf'],
])

export function staticLinkGenerator(key, isoCode = '') {
  let selectedDictionary = AppSettings.evo.enable ? evoLinkDictionary : ibsLinkDictionary

  return (selectedDictionary.get(key) || '#').replace('{isoCode}', isoCode)
}
