// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Script, console} from "forge-std/Script.sol";
import {BridgeRegistry} from "../../../contracts/bridge/interop/BridgeRegistry.sol";

contract InitializeRegistry is Script {
    function run(address registryAddress) external {
        BridgeRegistry registry = BridgeRegistry(registryAddress);
        
        vm.startBroadcast();
        
        // Register Polygon
        registry.registerDestination(
            137,
            "Polygon",
            128,
            3600,
            10, // 0.1%
            address(0x200)
        );
        
        // Register Optimism
        registry.registerDestination(
            10,
            "Optimism",
            1,
            1800,
            10,
            address(0x200)
        );
        
        // Register Base
        registry.registerDestination(
            8453,
            "Base",
            1,
            1800,
            10,
            address(0x200)
        );
        
        // Register Arbitrum
        registry.registerDestination(
            42161,
            "Arbitrum",
            1,
            1800,
            10,
            address(0x200)
        );
        
        // Register Etherlink (Tezos EVM L2)
        registry.registerDestination(
            42793,
            "Etherlink Mainnet",
            1,
            1800,
            10,
            address(0x200)
        );
        
        // Register XRPL
        registry.registerDestination(
            0,
            "XRPL",
            1,
            300,
            20, // 0.2%
            address(0x200)
        );
        
        // Register Tezos L1 (non-EVM; chainId 1 in registry for non-EVM slot)
        registry.registerDestination(
            1,
            "Tezos-Mainnet",
            1,
            300,
            20,
            address(0x200)
        );
        
        // Register native ETH token (Polygon, Optimism, Base, Arbitrum, Etherlink, XRPL, Tezos)
        uint256[] memory allDestinations = new uint256[](7);
        allDestinations[0] = 137;
        allDestinations[1] = 10;
        allDestinations[2] = 8453;
        allDestinations[3] = 42161;
        allDestinations[4] = 42793;
        allDestinations[5] = 0;
        allDestinations[6] = 1;
        
        registry.registerToken(
            address(0), // Native ETH
            1 ether / 1000, // 0.001 ETH min
            100 ether, // 100 ETH max
            allDestinations,
            0, // riskLevel
            0 // bridgeFeeBps
        );
        
        vm.stopBroadcast();
        
        console.log("Registry initialized successfully");
    }
}
