import { createKillSwitchClient } from '@bytelyst/kill-switch-client';
import { createWebTelemetry } from '@bytelyst/telemetry-client';
import { getRuntimeEnvironment } from './runtime.js';
import { productConfig } from './product.js';

export function createTradingKillSwitchClient(platform: 'web' | 'mobile') {
  const runtime = getRuntimeEnvironment(platform);
  return createKillSwitchClient({
    baseUrl: runtime.platformApiUrl,
    productId: runtime.productId,
    platform,
  });
}

export function createTradingWebTelemetry() {
  const runtime = getRuntimeEnvironment('web');
  return createWebTelemetry({
    productId: runtime.productId,
    channel: 'invttrdg_web',
    baseUrl: runtime.platformApiUrl,
    appVersion: productConfig.version,
    releaseChannel: process.env.NODE_ENV === 'production' ? 'prod' : 'dev',
  });
}
