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

import { PartnershipBondV3Safe } from "../../contracts/bonds/PartnershipBondV3Safe.sol";
import { BondStateV3 } from "../../contracts/bonds/BondStateV3.sol";
import { V3Fixtures } from "../helpers/V3Fixtures.sol";

/// @notice Disputes cannot alter a V3Safe custody state or payout.
contract Inv10_UpheldChallengesPersist is V3Fixtures {
    PartnershipBondV3Safe internal bonds;
    uint256 internal bondId;

    function setUp() public {
        _setUpDependencies();
        bonds = new PartnershipBondV3Safe(
            owner, address(0), address(consensus), address(disputeRegistry), 10 ether, 20 ether, 100 ether, address(0)
        );
        bondId = _createPartnership(bonds, _partnershipTerms(10, 1 ether, 2 ether));
        _fundActivePartnership(bonds, bondId, 1 ether, 2 ether);
    }

    function test_disputeEntryPointsCannotFreezeCancelOrPayPrincipal() external {
        vm.expectRevert(PartnershipBondV3Safe.PilotMutualConsentOnly.selector);
        bonds.challengeSettlement(bondId, 1);
        vm.expectRevert(PartnershipBondV3Safe.PilotMutualConsentOnly.selector);
        bonds.resolveChallenge(bondId);
        assertEq(uint256(bonds.bondOf(bondId).state), uint256(BondStateV3.State.Active));
        assertEq(bonds.creditOf(address(0), partyA) + bonds.creditOf(address(0), partyB), 0);
    }
}
