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

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

/**
 * @notice Optional: Deploy GenericStateChannelManager (state channels with stateHash).
 * Set CHANNEL_ADMIN, CHALLENGE_WINDOW_SECONDS. Deploy to same chain as PaymentChannelManager if desired.
 */
contract DeployGenericStateChannelManager is Script {
    function run() external {
        uint256 pk = vm.envUint("PRIVATE_KEY");
        address deployer = vm.addr(pk);
        address admin = vm.envOr("CHANNEL_ADMIN", deployer);
        uint256 challengeWindow = vm.envOr("CHALLENGE_WINDOW_SECONDS", uint256(86400));
        vm.startBroadcast(pk);
        GenericStateChannelManager manager = new GenericStateChannelManager(admin, challengeWindow);
        console.log("GenericStateChannelManager deployed at:", address(manager));
        console.log("Admin:", admin);
        vm.stopBroadcast();
    }
}
