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

import {Script, console} from "forge-std/Script.sol";
import {CCIPReceiver} from "../contracts/ccip/CCIPReceiver.sol";

/**
 * @title DeployCCIPReceiver
 * @notice Deploy CCIPReceiver contract for receiving cross-chain messages
 */
contract DeployCCIPReceiver is Script {
    function run() external {
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
        address deployer = vm.addr(deployerPrivateKey);
        
        // Load environment variables
        address ccipRouter = vm.envAddress("CCIP_ROUTER_ADDRESS");
        address oracleAggregator = vm.envAddress("ORACLE_AGGREGATOR_ADDRESS");
        
        console.log("Deploying CCIPReceiver with deployer:", vm.toString(deployer));
        console.log("CCIP Router:", vm.toString(ccipRouter));
        console.log("Oracle Aggregator:", vm.toString(oracleAggregator));
        
        vm.startBroadcast(deployerPrivateKey);
        
        CCIPReceiver receiver = new CCIPReceiver(ccipRouter, oracleAggregator);
        console.log("CCIPReceiver deployed at:", vm.toString(address(receiver)));
        
        vm.stopBroadcast();
        
        console.log("\n=== Deployment Summary ===");
        console.log("CCIPReceiver:", vm.toString(address(receiver)));
        console.log("CCIP Router:", vm.toString(ccipRouter));
        console.log("Oracle Aggregator:", vm.toString(oracleAggregator));
    }
}

