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

import "forge-std/Test.sol";
import "../../contracts/m00-diamond/facets/M00MainnetBridgeFacet.sol";
import "../../contracts/m00-diamond/interfaces/IM00MainnetBridgeFacet.sol";

contract M00MainnetBridgeFacetTest is Test {
    M00MainnetBridgeFacet public facet;
    address admin = address(0xA11CE);

    function setUp() public {
        facet = new M00MainnetBridgeFacet(admin);
    }

    function test_wireAndReadConfig() public {
        IM00MainnetBridgeFacet.BridgeConfig memory cfg = IM00MainnetBridgeFacet.BridgeConfig({
            chain138BatchEmitter: address(0x1001),
            chain138Mirror: address(0x1002),
            mainnetCheckpoint: address(0x2001),
            mainnetMirror: address(0x2002),
            mainnetTether: address(0x2003),
            rwaTokenFactory: address(0x3001),
            rwaTokenRegistry: address(0x3002)
        });
        vm.prank(admin);
        facet.wireMainnetBridge(cfg);
        IM00MainnetBridgeFacet.BridgeConfig memory out = facet.getMainnetBridgeConfig();
        assertEq(out.mainnetMirror, address(0x2002));
        assertEq(out.rwaTokenFactory, address(0x3001));
    }
}
