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

import { IOptimizer, OptimizerInput } from "./IOptimizer.sol";
import { Optimizer } from "./Optimizer.sol";
import { OptimizerV3Push3Lib } from "./OptimizerV3Push3Lib.sol";

/**
 * @title OptimizerV3
 * @notice UUPS-upgradeable Optimizer whose calculateParams is overridden by
 *         the Push3 transpiler output.  Delegates to OptimizerV3Push3Lib —
 *         the single canonical copy of the transpiler logic — so that future
 *         transpiler changes require only one edit.
 *
 * @dev No new storage slots.  Only overrides the pure calculateParams function.
 *      Register-to-output mapping must match OptimizerV3Push3 exactly:
 *        r40 -> ci, r39 -> anchorShare, r38 -> anchorWidth, r37 -> discoveryDepth
 */
contract OptimizerV3 is Optimizer {
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function calculateParams(OptimizerInput[8] memory inputs)
        public
        pure
        override
        returns (uint256 ci, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth)
    {
        return OptimizerV3Push3Lib.calculateParams(inputs);
    }
}
