import { AgreementsInterface, Agreement, AppAreas } from '..'
import Vue from 'vue'
import Const from '@/config/const'

export default class Default implements AgreementsInterface {
  appArea: AppAreas = 'enrolment'

  processAgreement(
    rootState: any,
    rootGetters: any,
    country: string,
    links: { [p: string]: string }
  ): Agreement | null {
    let agreement: Agreement = {
      name: 'enrolment',
      messages: (msg => {
        if (country === 'malaysia') {
          msg.push(Vue.i18n.translate('Enrolment.Agreement.Malaysia.Waive')!)
        }
        return msg
      })([
        Vue.i18n.translate('Enrolment.Agreement.Standard', {
          link: `<a target='_blank' href='${links['termsOfAgreement']}'>${Vue.i18n.translate(
            'Enrolment.Agreement.toa.Title'
          )}</a>`,
          website: `<a target='_blank' href='${Const.constLinks.COMPANY_SITE.value}'>${Const.constLinks.COMPANY_SITE.text}</a>`,
        })!,
      ])!,
    }

    return agreement
  }
}
