type PriceObj = {
    trialPay_1: string,
    trialPay_5: string,
    trialPay_9: string,
    trialPay_13: string,
    planPrice: string,
    oldPlanPrice: string,
    basicPlan: string
}

export type UsdToEurGbpProps = {
    pricesUSD: PriceObj,
    pricesEurGbp?: PriceObj
}

export const COUNTRIES_USING_EUR_GBP = {
    'AT': 'EUR',
    'BE': 'EUR',
    'CY': 'EUR',
    'EE': 'EUR',
    'FI': 'EUR',
    'FR': 'EUR',
    'DE': 'EUR',
    'GR': 'EUR',
    'IE': 'EUR',
    'IT': 'EUR',
    'LV': 'EUR',
    'LT': 'EUR',
    'LU': 'EUR',
    'MT': 'EUR',
    'NL': 'EUR',
    'PT': 'EUR',
    'SK': 'EUR',
    'SI': 'EUR',
    'ES': 'EUR',
    'GB': 'GBP',
};

const getChangedUsdToEurGbp = ({ pricesUSD, pricesEurGbp }: UsdToEurGbpProps) => ({
    [pricesUSD.trialPay_1]: pricesEurGbp?.trialPay_1,
    [pricesUSD.trialPay_5]: pricesEurGbp?.trialPay_5,
    [pricesUSD.trialPay_9]: pricesEurGbp?.trialPay_9,
    [pricesUSD.trialPay_13]: pricesEurGbp?.trialPay_13,
    [pricesUSD.planPrice]: pricesEurGbp?.planPrice,
    [pricesUSD.oldPlanPrice]: pricesEurGbp?.oldPlanPrice,
    [pricesUSD.basicPlan]: pricesEurGbp?.basicPlan
});

const getChangedUsd = ({ pricesUSD }: UsdToEurGbpProps) => ({
    [pricesUSD.trialPay_1]: pricesUSD.trialPay_1,
    [pricesUSD.trialPay_5]: pricesUSD.trialPay_5,
    [pricesUSD.trialPay_9]: pricesUSD.trialPay_9,
    [pricesUSD.trialPay_13]: pricesUSD.trialPay_13,
    [pricesUSD.planPrice]: pricesUSD.planPrice,
    [pricesUSD.oldPlanPrice]: pricesUSD.oldPlanPrice,
    [pricesUSD.basicPlan]: pricesUSD.basicPlan
})

export const getChangedCurrencies = (props: UsdToEurGbpProps) => ({
    USD: getChangedUsd(props),
    EUR: getChangedUsdToEurGbp(props),
    GBP: getChangedUsdToEurGbp(props)
})

export const CURRENCY_LABELS = {
    USD: '$',
    GBP: '£',
    EUR: '€'
};