import gspy_interface_robust

# Reset state for clean test
gspy_interface_robust.reset_state()

print('Testing controlled response (should use fallback):')
print('=' * 55)

# Force fallback mode by testing controlled response directly
print('Direct controlled response test:')
for i in range(8):
    result = gspy_interface_robust._calculate_controlled_response(0.075)
    print(f'Day {i+1}: {result:.4f} m³/s')

print('\nTesting different recharge rates at equilibrium:')
gspy_interface_robust.reset_state()

test_rates = [0.0, 0.05, 0.075, 0.1, 0.15]
for rate in test_rates:
    # Reset and run to equilibrium
    gspy_interface_robust.reset_state()
    for _ in range(8):
        result = gspy_interface_robust._calculate_controlled_response(rate)
    print(f'Recharge {rate:.3f} m/day → Equilibrium ~{result:.4f} m³/s')

print(f'\nTarget verification (0.075 m/day should be ~0.25-0.35 m³/s)')

# Test actual GSPy interface (may use MODFLOW or fallback)
print('\nTesting full GSPy interface:')
gspy_interface_robust.reset_state()
for i in range(5):
    result = gspy_interface_robust.run_modflow_step(0.075)
    print(f'GSPy Call {i+1}: {result[0]:.4f} m³/s')