/**
 * @file bridge.config.example.ts
 * @notice Example bridge configuration file
 * @description Copy this file to bridge.config.ts and fill in your values
 */

export const bridgeConfig = {
    // Chain 138 Configuration
    chain138: {
        rpcUrl: process.env.CHAIN_138_RPC_URL || 'http://localhost:8545',
        chainId: 138,
        escrowVaultAddress: process.env.ESCROW_VAULT_ADDRESS || '',
        registryAddress: process.env.REGISTRY_ADDRESS || '',
        wXRPAddress: process.env.WXRP_ADDRESS || '',
        mintBurnControllerAddress: process.env.MINT_BURN_CONTROLLER_ADDRESS || '',
        verifierAddress: process.env.VERIFIER_ADDRESS || ''
    },

    // thirdweb Configuration
    thirdweb: {
        clientId: process.env.THIRDWEB_CLIENT_ID || '542981292d51ec610388ba8985f027d7'
    },

    // XRPL Configuration
    xrpl: {
        server: process.env.XRPL_SERVER || 'wss://s1.ripple.com',
        account: process.env.XRPL_ACCOUNT || '',
        secret: process.env.XRPL_SECRET || '',
        destinationTag: process.env.XRPL_DESTINATION_TAG ? parseInt(process.env.XRPL_DESTINATION_TAG) : undefined
    },

    // HSM Configuration
    hsm: {
        endpoint: process.env.HSM_ENDPOINT || 'http://localhost:8080',
        apiKey: process.env.HSM_API_KEY || '',
        keyId: process.env.HSM_KEY_ID || ''
    },

    // FireFly Configuration
    firefly: {
        apiUrl: process.env.FIREFLY_API_URL || 'http://localhost:5000',
        apiKey: process.env.FIREFLY_API_KEY || ''
    },

    // Cacti Configuration
    cacti: {
        apiUrl: process.env.CACTI_API_URL || 'http://localhost:4000',
        evmConnectorId: process.env.CACTI_EVM_CONNECTOR_ID || '',
        xrplConnectorId: process.env.CACTI_XRPL_CONNECTOR_ID || '',
        fabricConnectorId: process.env.CACTI_FABRIC_CONNECTOR_ID || ''
    },

    // Policy Configuration
    policy: {
        quorumThreshold: 6667, // 66.67% in basis points
        defaultTimeout: 3600, // 1 hour in seconds
        maxDailyVolume: '1000000000000000000000' // 1000 ETH in wei
    },

    // Observability Configuration
    observability: {
        prometheusEnabled: process.env.PROMETHEUS_ENABLED === 'true',
        prometheusPort: parseInt(process.env.PROMETHEUS_PORT || '9090'),
        logLevel: process.env.LOG_LEVEL || 'info',
        maxLogs: parseInt(process.env.MAX_LOGS || '10000')
    },

    // Supported Destinations
    destinations: [
        {
            chainId: 137,
            chainName: 'Polygon',
            enabled: true,
            minFinalityBlocks: 128,
            timeoutSeconds: 3600,
            baseFee: 10, // 0.1% in basis points
            feeRecipient: process.env.POLYGON_FEE_RECIPIENT || ''
        },
        {
            chainId: 10,
            chainName: 'Optimism',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.OPTIMISM_FEE_RECIPIENT || ''
        },
        {
            chainId: 8453,
            chainName: 'Base',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.BASE_FEE_RECIPIENT || ''
        },
        {
            chainId: 42161,
            chainName: 'Arbitrum',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.ARBITRUM_FEE_RECIPIENT || ''
        },
        {
            chainId: 43114,
            chainName: 'Avalanche',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 3600,
            baseFee: 10,
            feeRecipient: process.env.AVALANCHE_FEE_RECIPIENT || ''
        },
        {
            chainId: 56,
            chainName: 'BNB Chain',
            enabled: true,
            minFinalityBlocks: 15,
            timeoutSeconds: 3600,
            baseFee: 10,
            feeRecipient: process.env.BNB_FEE_RECIPIENT || ''
        },
        {
            chainId: 100,
            chainName: 'Gnosis Chain',
            enabled: true,
            minFinalityBlocks: 12,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.GNOSIS_FEE_RECIPIENT || ''
        },
        {
            chainId: 42220,
            chainName: 'Celo',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.CELO_FEE_RECIPIENT || ''
        },
        {
            chainId: 1111,
            chainName: 'Wemix',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 1800,
            baseFee: 10,
            feeRecipient: process.env.WEMIX_FEE_RECIPIENT || ''
        },
        {
            chainId: 0,
            chainName: 'XRPL',
            enabled: true,
            minFinalityBlocks: 1,
            timeoutSeconds: 300,
            baseFee: 20, // 0.2% for XRPL
            feeRecipient: process.env.XRPL_FEE_RECIPIENT || ''
        }
    ],

    // Allowed Tokens
    allowedTokens: [
        {
            address: '0x0000000000000000000000000000000000000000', // Native ETH
            minAmount: '1000000000000000', // 0.001 ETH
            maxAmount: '100000000000000000000', // 100 ETH
            allowedDestinations: [137, 10, 8453, 42161, 43114, 56, 100, 42220, 1111, 0], // All destinations
            riskLevel: 0,
            bridgeFeeBps: 0
        },
        {
            address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
            minAmount: '1000000000000000',
            maxAmount: '100000000000000000000',
            allowedDestinations: [137, 10, 8453, 42161, 43114, 56, 100, 42220, 1111],
            riskLevel: 0,
            bridgeFeeBps: 5 // 0.05%
        }
    ]
};
