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

import {Script, console2} from "forge-std/Script.sol";
import {OMNLMirrorCoordinator} from "../../contracts/hybx-omnl/OMNLMirrorCoordinator.sol";

/// @notice Deploy OMNLMirrorCoordinator and configure mirror destination (CCIP router + reserve store from env).
contract DeployMirrorCoordinator is Script {
    function run() external {
        uint256 pk = vm.envUint("PRIVATE_KEY");
        address admin = vm.addr(pk);
        address router = vm.envAddress("OMNL_CCIP_ROUTER");
        address store = vm.envAddress("OMNL_RESERVE_COMMITMENT_STORE");
        address receiver = vm.envAddress("OMNL_MIRROR_RECEIVER");
        uint64 destChainSelector = uint64(vm.envUint("OMNL_CCIP_DEST_CHAIN_SELECTOR"));
        address feeToken = vm.envAddress("OMNL_CCIP_FEE_TOKEN");

        vm.startBroadcast(pk);
        OMNLMirrorCoordinator coord = new OMNLMirrorCoordinator(router, store, admin);
        coord.setMirrorDestination(destChainSelector, receiver, feeToken);
        vm.stopBroadcast();

        console2.log("OMNLMirrorCoordinator", address(coord));
    }
}
