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

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

  processAgreement(
    rootState: any,
    rootGetters: any,
    country: string,
    links: { [p: string]: string }
  ): Agreement | null {
    if (rootGetters['eshop/getCartHasRental'] === true) {
      let agreement: Agreement = {
        name: 'eshop',
        messages: [
          Vue.i18n.translate('Eshop.Agreement.RentalSalesOrder', {
            link: `<a target='_blank' href='${links['rentalTerms']}'>${Vue.i18n.translate(
              'Eshop.Agreement.RentalTerms'
            )}</a>`,
            website: `<a target='_blank' href='${Const.constLinks.COMPANY_SITE.value}'>${Const.constLinks.COMPANY_SITE.text}</a>`,
          })!,
        ],
      }

      return agreement
    }

    return null
  }
}
