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

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

/// @title Inv05_NoSelfReportPayout
/// @notice No caller, oracle result, or evidence label can create a payout.
contract Inv05_NoSelfReportPayout is V3Fixtures {
    AccountabilityBondV3Safe internal bonds;
    uint256 internal bondId;

    function setUp() public {
        _setUpDependencies();
        bonds = new AccountabilityBondV3Safe(
            owner, address(consensus), address(disputeRegistry), 10 ether, 100 ether, address(0)
        );
        bondId = _createAccountability(bonds, _accountabilityTerms(5, 2 ether));
        _fundActiveAccountability(bonds, bondId, 2 ether);
    }

    function test_selfReportAndLegacySettlementCallsCannotCreatePayout() external {
        vm.prank(company);
        (bool attestOk,) = address(bonds)
            .call(
                abi.encodeWithSignature(
                    "attestBreach(uint256,uint256,bytes32,uint96)", bondId, 1 ether, keccak256("self-report"), 5
                )
            );
        assertFalse(attestOk);
        (bool advanceOk,) = address(bonds).call(abi.encodeWithSignature("advanceToFinalizable(uint256)", bondId));
        assertFalse(advanceOk);
        (bool freezeOk,) = address(bonds).call(abi.encodeWithSignature("freezeSettlement(uint256,uint96)", bondId, 5));
        assertFalse(freezeOk);
        (bool settleOk,) = address(bonds).call(abi.encodeWithSignature("settle(uint256)", bondId));
        assertFalse(settleOk);

        assertEq(bonds.creditOf(address(0), counterparty), 0, "legacy input created a payout");
        assertEq(bonds.creditOf(address(0), company), 0, "legacy input created a refund");
    }
}
