import { UseCases } from './use-cases.factory';
import { DeviceController } from '../../interface/controllers/device.controller';
import { WalletController } from '../../interface/controllers/wallet.controller';
import { NetworkController } from '../../interface/controllers/network.controller';
import { TokenController } from '../../interface/controllers/token.controller';
import { BalanceController } from '../../interface/controllers/balance.controller';
import { TransactionController } from '../../interface/controllers/transaction.controller';
import { AdminController } from '../../interface/controllers/admin.controller';
import { ImageController } from '../../interface/controllers/image.controller';
import { AddressController } from '../../interface/controllers/address.controller';

export interface Controllers {
  deviceController: DeviceController;
  walletController: WalletController;
  networkController: NetworkController;
  tokenController: TokenController;
  balanceController: BalanceController;
  transactionController: TransactionController;
  adminController: AdminController;
  imageController: ImageController;
  addressController: AddressController;
}

export const createControllers = (useCases: UseCases): Controllers => {
  return {
    deviceController: new DeviceController(
      useCases.createDevice,
      useCases.getDeviceById,
      useCases.getAllDevices,
      useCases.updateDeviceStatus,
      useCases.updateDevicePushToken,
    ),
    walletController: new WalletController(
      useCases.generateWalletSeedphrase,
      useCases.createWallet,
      useCases.getWalletById,
      useCases.getWalletsByDevice,
      useCases.getWalletAddressForNetwork,
      useCases.getAllNetworkAddressesForWallet,
      useCases.getWalletSeedPhrase,
    ),
    networkController: new NetworkController(
      useCases.getNetworksList,
      useCases.getNetworkGasInfo,
    ),
    tokenController: new TokenController(
      useCases.getTokenById,
      useCases.getTokenBySymbol,
      useCases.getTokensByNetwork,
      useCases.getAllTokens,
      useCases.getTokenChart,
      useCases.getTokenPrices,
      useCases.resolveTokenByContract,
    ),
    balanceController: new BalanceController(
      useCases.getWalletBalancesForNetwork,
      useCases.getAllWalletBalances,
    ),
    transactionController: new TransactionController(
      useCases.createTransaction,
      useCases.getTransactions,
      useCases.getTransactionById,
      useCases.updateTransaction,
      useCases.transactionRate,
    ),
    adminController: new AdminController(
      useCases.createNetwork,
      useCases.createToken,
      useCases.updateToken,
      useCases.deleteToken,
      useCases.updateTokenMinimumSwapValue,
      useCases.fetchTokenData,
    ),
    imageController: new ImageController(useCases.getImage),
    addressController: new AddressController(useCases.getAddressByAddress),
  };
};
