"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createServices = void 0;
const path_1 = __importDefault(require("path"));
const pino_logger_1 = require("../../infrastructure/logging/pino-logger");
const redis_cache_service_1 = require("../../infrastructure/cache/redis-cache-service");
const aes_gcm_encryption_service_1 = require("../../infrastructure/security/aes-gcm-encryption-service");
const coinmarketcap_client_1 = require("../../infrastructure/external/coinmarketcap-client");
const deterministic_address_generator_1 = require("../../infrastructure/external/deterministic-address-generator");
const external_api_key_rotation_service_1 = require("../../infrastructure/external/external-api-key-rotation.service");
const network_rpc_client_1 = require("../../infrastructure/external/network-rpc-client");
const seed_phrase_service_1 = require("../../application/services/seed-phrase.service");
const wallet_balance_service_1 = require("../../domain/services/wallet-balance.service");
const in_memory_event_publisher_1 = require("../../infrastructure/events/in-memory-event-publisher");
const file_image_storage_service_1 = require("../../infrastructure/storage/file-image-storage.service");
const coinmarketcap_thumbnail_resolver_1 = require("../../infrastructure/external/coinmarketcap-thumbnail-resolver");
const env_1 = require("../config/env");
const createServices = (redisClient) => {
    const logger = new pino_logger_1.PinoLogger();
    const cacheService = new redis_cache_service_1.RedisCacheService(redisClient);
    const encryptionService = new aes_gcm_encryption_service_1.AesGcmEncryptionService();
    const addressGenerator = new deterministic_address_generator_1.DeterministicAddressGenerator(encryptionService);
    const seedPhraseService = new seed_phrase_service_1.SeedPhraseService();
    const balanceService = new wallet_balance_service_1.WalletBalanceService();
    const externalApiKeyRotationService = new external_api_key_rotation_service_1.ExternalApiKeyRotationService(redisClient, logger);
    const coinMarketCapClient = new coinmarketcap_client_1.CoinMarketCapClient(cacheService, externalApiKeyRotationService, logger);
    const thumbnailResolver = new coinmarketcap_thumbnail_resolver_1.CoinMarketCapThumbnailResolver(coinMarketCapClient);
    const imageStorage = new file_image_storage_service_1.FileImageStorageService(env_1.env.PUBLIC_BASE_URL, path_1.default.resolve(process.cwd(), env_1.env.IMAGES_DIR), thumbnailResolver);
    const networkRpcClient = new network_rpc_client_1.NetworkRpcClient();
    const eventPublisher = new in_memory_event_publisher_1.InMemoryDomainEventPublisher();
    return {
        logger,
        cacheService,
        encryptionService,
        addressGenerator,
        seedPhraseService,
        balanceService,
        coinMarketCapClient,
        networkRpcClient,
        imageStorage,
        thumbnailResolver,
        eventPublisher,
    };
};
exports.createServices = createServices;
//# sourceMappingURL=services.factory.js.map