from unittest.mock import Mock


def mock_parameter_manager(mock_restrained_component, mock_unrestrained_component):
    """Mock a parameter manager to handle the components required for the
    ScalingRestraints class."""
    apm = Mock()
    apm.components = {
        "restrained": {
            "object": mock_restrained_component,
            "n_params": mock_restrained_component.n_params,
            "start_idx": 0,
        },
        "unrestrained": {
            "object": mock_unrestrained_component,
            "n_params": mock_unrestrained_component.n_params,
            "start_idx": mock_restrained_component.n_params,
        },
    }
    apm.n_active_params = (
        mock_restrained_component.n_params + mock_unrestrained_component.n_params
    )
    return apm