/**
 * MPC Configuration
 */

export interface MpcConfig {
  coordinatorUrl: string;
  coordinatorTimeout: number;
  messageRouterWsUrl: string;
  shareMasterKey?: string;
  keygenTimeout: number;
  signingTimeout: number;
  refreshTimeout: number;
}

export const mpcConfig = (): MpcConfig => ({
  coordinatorUrl: process.env.MPC_COORDINATOR_URL || 'http://localhost:50051',
  coordinatorTimeout: parseInt(process.env.MPC_COORDINATOR_TIMEOUT || '30000', 10),
  messageRouterWsUrl: process.env.MPC_MESSAGE_ROUTER_WS_URL || 'ws://localhost:50052',
  shareMasterKey: process.env.SHARE_MASTER_KEY,
  keygenTimeout: parseInt(process.env.MPC_KEYGEN_TIMEOUT || '300000', 10),
  signingTimeout: parseInt(process.env.MPC_SIGNING_TIMEOUT || '180000', 10),
  refreshTimeout: parseInt(process.env.MPC_REFRESH_TIMEOUT || '300000', 10),
});
