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

import {IAereMessageHandler} from "../AereOutboundVerifier.sol";

/// @title MockAereMessageHandler
/// @notice Records the last delivered message so tests can assert exactly-once,
///         correct-args delivery. TEST-ONLY.
contract MockAereMessageHandler is IAereMessageHandler {
    uint256 public lastSrcChainId;
    address public lastSender;
    bytes public lastPayload;
    uint256 public callCount;

    /// @notice When true, revert on delivery to test handler-failure propagation.
    bool public shouldRevert;

    function setShouldRevert(bool v) external {
        shouldRevert = v;
    }

    function handleAereMessage(uint256 srcChainId, address sender, bytes calldata payload)
        external
    {
        require(!shouldRevert, "handler: forced revert");
        lastSrcChainId = srcChainId;
        lastSender = sender;
        lastPayload = payload;
        callCount += 1;
    }
}
