import { NativeModules } from 'react-native';
import { Environment } from '@getpara/web-sdk';
function getPortalBaseURL(env) {
    switch (env) {
        case Environment.DEV:
            return 'http://localhost:3003';
        case Environment.SANDBOX:
            return 'https://app.sandbox.getpara.com';
        case Environment.BETA:
            return 'https://app.beta.getpara.com';
        case Environment.PROD:
            return 'https://app.getpara.com';
        default:
            throw new Error(`env: ${env} not supported`);
    }
}
function getBaseUrl(env) {
    switch (env) {
        case Environment.DEV:
            return 'http://localhost:8080/';
        case Environment.SANDBOX:
            return 'https://api.sandbox.getpara.com/';
        case Environment.BETA:
            return 'https://api.beta.getpara.com/';
        case Environment.PROD:
            return 'https://api.getpara.com/';
        default:
            throw new Error(`unsupported env: ${env}`);
    }
}
export function getBaseMPCNetworkWSUrl(env) {
    switch (env) {
        case Environment.DEV:
            return `ws://localhost:3000`;
        case Environment.SANDBOX:
            return `wss://mpc-network.sandbox.getpara.com`;
        case Environment.BETA:
            return `wss://mpc-network.beta.getpara.com`;
        case Environment.PROD:
            return `wss://mpc-network.getpara.com`;
        default:
            throw new Error(`unsupported env: ${env}`);
    }
}
export let userManagementServer = getBaseUrl(Environment.BETA);
export let portalBase = getPortalBaseURL(Environment.BETA);
export let mpcNetworkWSServer = getBaseMPCNetworkWSUrl(Environment.BETA);
export function setEnv(env) {
    userManagementServer = getBaseUrl(env);
    portalBase = getPortalBaseURL(env);
    mpcNetworkWSServer = getBaseMPCNetworkWSUrl(env);
    init();
}
const { ParaSignerModule } = NativeModules;
export const DEBUG_MODE_ENABLED = false;
function init() {
    ParaSignerModule.setServerUrl(userManagementServer);
    ParaSignerModule.setWsServerUrl(mpcNetworkWSServer);
}
init();
export { getBaseUrl, getPortalBaseURL };
