import { CUSTOMER_MODULE_PATHS } from "@/config/customer-module-paths";
import {
  bondModule,
  bondFundsModule,
  callDepositModule,
  cashModule,
  commodityModule,
  cryptoModule,
  currencyConversionModule,
  cashWithdrawalModule,
  fixedDepositModule,
  fxAccumulatorModule,
  interestDividendModule,
  leverageModule,
  mixedFundsModule,
  otherAssetsModule,
  stockModule,
  stockFundsModule,
  structureModule,
  swapsModule,
} from "@/app/customer/_lib/customer-asset-modules";
import { toTransactionModuleFormConfig } from "@/app/customer/_lib/customer-transaction-module";
import type { TransactionModuleFormConfig } from "./types";

export {
  customerTransactionModules,
  getCustomerTransactionModule,
  type CustomerTransactionModuleId,
} from "@/app/customer/_lib/customer-asset-modules";

export const cashFormConfig = toTransactionModuleFormConfig(cashModule);
export const swapsFormConfig: TransactionModuleFormConfig = {
  ...toTransactionModuleFormConfig(swapsModule),
  // Yii1 VERSION≥2: after save, return to Derivative hub (Swaps + FX Accumulator).
  returnListPath: CUSTOMER_MODULE_PATHS.derivativesCash,
};
export const currencyConversionFormConfig = toTransactionModuleFormConfig(currencyConversionModule);
export const cashWithdrawalFormConfig = toTransactionModuleFormConfig(cashWithdrawalModule);
export const fxAccumulatorFormConfig: TransactionModuleFormConfig = {
  ...toTransactionModuleFormConfig(fxAccumulatorModule),
  // Yii1 VERSION≥2: after save, return to Derivative hub (Swaps + FX Accumulator).
  returnListPath: CUSTOMER_MODULE_PATHS.derivativesCash,
};
export const interestDividendFormConfig = toTransactionModuleFormConfig(interestDividendModule);
export const stockFormConfig = toTransactionModuleFormConfig(stockModule);
export const stockFundsFormConfig = toTransactionModuleFormConfig(stockFundsModule);
export const structureFormConfig = toTransactionModuleFormConfig(structureModule);
export const bondFormConfig = toTransactionModuleFormConfig(bondModule);
export const bondFundsFormConfig = toTransactionModuleFormConfig(bondFundsModule);
export const commodityFormConfig = toTransactionModuleFormConfig(commodityModule);
export const otherAssetsFormConfig = toTransactionModuleFormConfig(otherAssetsModule);
export const mixedFundsFormConfig = toTransactionModuleFormConfig(mixedFundsModule);
export const cryptoFormConfig = toTransactionModuleFormConfig(cryptoModule);
export const fixedDepositFormConfig: TransactionModuleFormConfig = {
  ...toTransactionModuleFormConfig(fixedDepositModule),
  // Yii1 VERSION≥2: after save, return to Deposit hub (combined Fixed+Call list).
  returnListPath: CUSTOMER_MODULE_PATHS.deposit,
};
export const callDepositFormConfig: TransactionModuleFormConfig = {
  ...toTransactionModuleFormConfig(callDepositModule),
  // Yii1 VERSION≥2: after save, return to Deposit hub (combined Fixed+Call list).
  returnListPath: CUSTOMER_MODULE_PATHS.deposit,
};
export const leverageFormConfig = toTransactionModuleFormConfig(leverageModule);
