import { composeHooks } from "../../utils/composeHooks";
import { useLeftApyModule } from "../hooks/modules/useLeftApyModule";
import { createUseRightBalanceAsset } from "../hooks/useRightBalanceAsset";
import { useLeftMarketTrendModule } from "../hooks/modules/useLeftMarketTrendModule";
import { useRightMarketTrendModule } from "../hooks/modules/useRightMarketTrendModule";
const getRightElement = (AssetConfigurationDeps) => (rightElement) => {
    switch (rightElement) {
        case "undefined":
            return undefined;
        case "marketTrend":
            return (currencies) => useRightMarketTrendModule({
                currencies,
                useBalanceDeps: AssetConfigurationDeps.useBalanceDeps,
                MarketPriceIndicator: AssetConfigurationDeps.MarketPriceIndicator,
            });
        case "balance":
        default:
            return createUseRightBalanceAsset({
                useBalanceDeps: AssetConfigurationDeps.useBalanceDeps,
                balanceItem: AssetConfigurationDeps.balanceItem,
                assetsMap: AssetConfigurationDeps.assetsMap,
            });
    }
};
const getLeftElement = (AssetConfigurationDeps) => (leftElement) => {
    switch (leftElement) {
        case "apy":
            return (assets) => useLeftApyModule(assets, AssetConfigurationDeps.ApyIndicator);
        case "marketTrend":
            return (assets) => useLeftMarketTrendModule(assets, AssetConfigurationDeps.MarketPercentIndicator);
        case "undefined":
        default:
            return undefined;
    }
};
const createAssetConfigurationHook = deps => ({ assetsConfiguration }) => {
    const { rightElement, leftElement } = assetsConfiguration ?? {};
    const rightHook = getRightElement(deps)(rightElement);
    const leftHook = getLeftElement(deps)(leftElement);
    // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
    const hooks = [rightHook, leftHook].filter(Boolean);
    return (assets) => {
        const composedHook = composeHooks(...hooks);
        return composedHook(assets);
    };
};
export default createAssetConfigurationHook;
//# sourceMappingURL=createAssetConfiguration.js.map