// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.19;

/**
 * @title ExtremeOptimizer
 * @notice Pushes parameters to extremes to find breaking points
 * @dev Cycles through extreme parameter combinations to stress test the protocol
 */
contract ExtremeOptimizer {
    uint256 private callCount;

    function getOptimalParameters(
        uint256, // percentageStaked
        uint256, // avgTaxRate
        uint256 // sentiment
    )
        external
        returns (uint256, uint256, uint256, uint256)
    {
        callCount++;

        // Cycle through extreme scenarios
        uint256 scenario = callCount % 5;

        if (scenario == 0) {
            // Extreme capital inefficiency with minimal anchor
            return (
                1e18, // 100% capital inefficiency (KRAIKEN valued at 170%)
                0.01e18, // 1% anchor share (99% to floor)
                1, // 1% anchor width (extremely narrow)
                10e18 // 10x discovery depth
            );
        } else if (scenario == 1) {
            // Zero capital inefficiency with maximum anchor
            return (
                0, // 0% capital inefficiency (KRAIKEN valued at 70%)
                0.99e18, // 99% anchor share (minimal floor)
                100, // 100% anchor width (maximum range)
                0.1e18 // 0.1x discovery depth (minimal discovery)
            );
        } else if (scenario == 2) {
            // Oscillating between extremes
            return (
                callCount % 2 == 0 ? 1e18 : 0, // Flip between 0% and 100%
                0.5e18, // 50% anchor share
                50, // 50% width
                callCount % 2 == 0 ? 10e18 : 0.1e18 // Flip discovery depth
            );
        } else if (scenario == 3) {
            // Edge case: Everything at minimum
            return (
                0, // Minimum capital inefficiency
                0, // Minimum anchor share (all to floor)
                1, // Minimum width
                0 // No discovery liquidity
            );
        } else {
            // Edge case: Everything at maximum
            return (
                1e18, // Maximum capital inefficiency
                1e18, // Maximum anchor share (no floor)
                100, // Maximum width
                100e18 // Extreme discovery depth
            );
        }
    }
}
