import gspy_interface_robust

# Test the configurable parameters
print('Testing Configurable GSPy Interface')
print('=' * 50)

# Reset state
gspy_interface_robust.reset_state()

# Default parameters test
print('1. Default parameters (0.075 m/day recharge):')
for i in range(5):
    result = gspy_interface_robust.run_modflow_step(0.075)
    print(f'   Day {i+1}: {result[0]:.4f} m³/s')

# Test with custom fallback parameters
print('\n2. Custom fallback parameters (faster response):')
gspy_interface_robust.reset_state()

# Parameters: recharge, storage_rate, max_additional, base_flow, hk, sy, river_conductance  
# Faster response: higher storage_rate
for i in range(5):
    result = gspy_interface_robust.run_modflow_step(0.075, 0.7, 0.35, 0.08, 8.0, 0.18, 50.0)
    print(f'   Day {i+1}: {result[0]:.4f} m³/s')

# Test with slower response parameters
print('\n3. Slower response parameters:')
gspy_interface_robust.reset_state()

# Slower response: lower storage_rate
for i in range(8):
    result = gspy_interface_robust.run_modflow_step(0.075, 0.2, 0.30, 0.05, 8.0, 0.18, 50.0)
    print(f'   Day {i+1}: {result[0]:.4f} m³/s')

# Test different recharge rates with custom parameters
print('\n4. Different recharge rates at equilibrium:')
test_rates = [0.0, 0.05, 0.075, 0.1, 0.15]
for rate in test_rates:
    gspy_interface_robust.reset_state()
    # Run to near-equilibrium with custom parameters
    for _ in range(8):
        result = gspy_interface_robust.run_modflow_step(rate, 0.5, 0.35, 0.06, 8.0, 0.18, 50.0)
    print(f'   {rate:.3f} m/day → {result[0]:.4f} m³/s')

print('\n5. Parameter sensitivity test (0.075 m/day, equilibrium values):')
print('   Base case (storage_rate=0.4, max_add=0.40, base=0.05):')
gspy_interface_robust.reset_state()
for _ in range(6): result = gspy_interface_robust.run_modflow_step(0.075, 0.4, 0.40, 0.05, 8.0, 0.18, 50.0)
print(f'     → {result[0]:.4f} m³/s')

print('   Higher storage_rate (0.8):')
gspy_interface_robust.reset_state()
for _ in range(6): result = gspy_interface_robust.run_modflow_step(0.075, 0.8, 0.40, 0.05, 8.0, 0.18, 50.0)
print(f'     → {result[0]:.4f} m³/s')

print('   Lower max_additional (0.25):')
gspy_interface_robust.reset_state()
for _ in range(6): result = gspy_interface_robust.run_modflow_step(0.075, 0.4, 0.25, 0.05, 8.0, 0.18, 50.0)
print(f'     → {result[0]:.4f} m³/s')

print('   Higher base_flow (0.10):')
gspy_interface_robust.reset_state()
for _ in range(6): result = gspy_interface_robust.run_modflow_step(0.075, 0.4, 0.40, 0.10, 8.0, 0.18, 50.0)
print(f'     → {result[0]:.4f} m³/s')