import { PaymentMethod } from '~/domains/paymentMethods';
import type { AssetHoldingsItem } from '~/utils/assets';
import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
export interface AmountInputInitOptions {
    apiKey: string;
    checkoutConfig: FunkitCheckoutConfig;
    paymentMethod: PaymentMethod;
    sourceHolding: AssetHoldingsItem | null;
    /** Default amount, in fiat since that's the default mode */
    defaultAmount: number | undefined;
    /** Target asset unit price, in USD */
    unitPrice: number;
    /** Maximum checkout amount, in USD */
    maxUsd: number;
    /** Minimum checkout amount, in USD */
    minUsd?: number;
    /** Currency code for the currently selected fiat currency. Defaults to USD */
    fiatCurrency?: string;
    /** Quick options, in fiat (not %) */
    quickOptions?: number[];
}
export interface AmountInputState {
    /** Current amount, in target asset */
    assetAmount: number;
    /** Current amount, in fiat */
    fiatAmount: number;
    /** Fiat currency */
    fiatCurrency: string;
    /** Current input value (with leading currency symbol if in fiat) */
    inputValue: string;
    /** Whether the input is currently in fiat */
    isInputInFiat: boolean;
    /** Estimated available amount, in USD (defaults to unlimited) */
    usdAvailableAmount: number | null;
    /** Maximum amount, in USD (defaults to unlimited) */
    usdMaxAmount: number | null;
    /** Minimum amount, in USD (defaults to 0) */
    usdMinAmount: number | null;
}
/** Derived state includes additional fields that are pure functions of base state */
export interface AmountInputDerivedState extends AmountInputState {
    inputError: AmountInputError | null;
    isValid: boolean;
}
export type AmountInputAction = {
    /** Switches between fiat and crypto input mode */
    type: 'toggleInputInFiat';
} | {
    /** Sets the input value as string */
    type: 'setInputValue';
    inputValue: string;
    unitPrice: number;
} | {
    /** Sets the input value as fiat amount */
    type: 'setFiatAmount';
    fiatAmount: number;
    unitPrice: number;
} | {
    /** Changes formatting to new currency code */
    type: 'setFiatCurrency';
    fiatCurrency: string;
};
export type AmountInputError = {
    /** Current amount is above available balance */
    type: 'aboveAvailable';
    usdAvailableAmount: number;
} | {
    /** Current amount is above maximum */
    type: 'aboveMax';
    usdMaxAmount: number;
} | {
    /** Current amount is below minimum */
    type: 'belowMin';
    usdMinAmount: number;
} | {
    /** Available balance is 0 */
    type: 'noAvailableBalance';
} | {
    /** Input is empty */
    type: 'noInput';
};
export declare function initializeState({ apiKey, checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, defaultAmount, fiatCurrency, quickOptions, }: AmountInputInitOptions): AmountInputState;
export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
export declare function getDerivedState(state: AmountInputState): AmountInputDerivedState;
