var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import React, { useState } from 'react';
import { TopUpWithFiat } from './Fiat';
import { TopUpWithCrypto } from './TopUpWithCrypto';
import { FooterSection } from '../commons/FooterSection';
import { TopUpProviderSupportService } from '../../core/services/TopUpProviderSupportService';
import { countries } from '../../core/utils/countries';
import { PayButton } from './PayButton';
import { getPayButtonState } from '../../app/TopUp/getPayButtonState';
import { ChooseTopUpMethodWrapper } from './ChooseTopUpMethodWrapper';
import { ChooseTopUpMethodHeader } from './ChooseTopUpMethodHeader';
export var ChooseTopUpMethod = function (_a) {
    var walletService = _a.walletService, onPayClick = _a.onPayClick, topUpClassName = _a.topUpClassName, logoColor = _a.logoColor;
    var _b = __read(useState(undefined), 2), topUpMethod = _b[0], setTopUpMethod = _b[1];
    var _c = __read(useState(function () { return new TopUpProviderSupportService(countries); }), 1), topUpProviderSupportService = _c[0];
    var _d = __read(useState(''), 2), amount = _d[0], setAmount = _d[1];
    var _e = __read(useState(undefined), 2), paymentMethod = _e[0], setPaymentMethod = _e[1];
    return (React.createElement(ChooseTopUpMethodWrapper, { className: topUpClassName, topUpMethod: topUpMethod },
        React.createElement(ChooseTopUpMethodHeader, { topUpMethod: topUpMethod, setTopUpMethod: setTopUpMethod }),
        topUpMethod === 'crypto' && React.createElement(TopUpWithCrypto, { walletService: walletService }),
        topUpMethod === 'fiat' && React.createElement(TopUpWithFiat, { walletService: walletService, topUpProviderSupportService: topUpProviderSupportService, amount: amount, onAmountChange: setAmount, paymentMethod: paymentMethod, onPaymentMethodChange: setPaymentMethod, logoColor: logoColor }),
        topUpMethod && React.createElement(FooterSection, { className: topUpClassName },
            React.createElement(PayButton, { onClick: function () { return onPayClick(paymentMethod, amount); }, state: getPayButtonState(paymentMethod, topUpProviderSupportService, amount, topUpMethod) }))));
};
//# sourceMappingURL=ChooseTopUpMethod.js.map