// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import { Test } from "forge-std/Test.sol";
import { BasePilotForkBootstrap } from "../../script/BasePilotForkSimulation.s.sol";
import { SafeBondFactoryV3 } from "../../contracts/bonds/SafeBondFactoryV3.sol";
import { PartnershipBondFactoryV3 } from "../../contracts/bonds/PartnershipBondFactoryV3.sol";
import { AccountabilityBondFactoryV3 } from "../../contracts/bonds/AccountabilityBondFactoryV3.sol";

contract BasePilotSimulationClosureV3Test is Test {
    function test_simulationDeploysOnlyReducedClosureAndZeroesRetiredBindings() external {
        vm.chainId(8453);
        BasePilotForkBootstrap bootstrap = new BasePilotForkBootstrap();
        BasePilotForkBootstrap.NativeBondCaps memory caps = BasePilotForkBootstrap.NativeBondCaps({
            partnershipParty: 0.01 ether,
            partnershipBond: 0.02 ether,
            partnershipAggregate: 0.2 ether,
            accountabilityBond: 0.02 ether,
            accountabilityAggregate: 0.2 ether
        });

        (
            address governance,
            address controller,
            address consensus,
            address partnershipFactory,
            address accountabilityFactory,
            address factory
        ) = bootstrap.deploy(caps);

        assertTrue(governance.code.length != 0);
        assertTrue(controller.code.length != 0);
        assertTrue(consensus.code.length != 0);
        assertTrue(partnershipFactory.code.length != 0);
        assertTrue(accountabilityFactory.code.length != 0);
        assertTrue(factory.code.length != 0);
        assertEq(SafeBondFactoryV3(factory).disputeRegistry(), address(0));
        assertEq(PartnershipBondFactoryV3(partnershipFactory).disputeRegistry(), address(0));
        assertEq(AccountabilityBondFactoryV3(accountabilityFactory).disputeRegistry(), address(0));
        assertFalse(SafeBondFactoryV3(factory).deployAllowed());
    }
}
