"""
Test MODFLOW availability and basic FloPy functionality
"""

import os
import sys

# Add current directory to path for virtual environment
venv_path = r"C:/Users/JasonLillywhite/OneDrive - GoldSim/Python/GoldSim_MODFLOW/.venv/Scripts/python.exe"

print("Testing MODFLOW Setup...")
print("=" * 40)

# Test 1: Check if MODFLOW executable exists
mf_exe = "mf2005.exe"
if os.path.exists(mf_exe):
    print(f"✓ MODFLOW executable found: {mf_exe}")
else:
    print(f"✗ MODFLOW executable not found: {mf_exe}")

# Test 2: Import FloPy
try:
    import flopy
    print(f"✓ FloPy imported successfully (version: {flopy.__version__})")
except ImportError as e:
    print(f"✗ FloPy import failed: {e}")
    sys.exit(1)

# Test 3: Test static model creation
try:
    from static_model_setup import create_static_model
    print("✓ Static model setup imported successfully")
    
    # Create a simple test model
    mf = create_static_model("test_model", ".")
    mf.exe_name = mf_exe
    print(f"✓ Static model created with {len(mf.packagelist)} packages")
    
    # List packages
    print("  Packages:", ", ".join([str(p) for p in mf.packagelist]))
    
except Exception as e:
    print(f"✗ Static model creation failed: {e}")

# Test 4: Test one GSPy function call
try:
    from gspy_interface import run_modflow_step
    print("✓ GSPy interface imported successfully")
    
    # Test one call
    result = run_modflow_step(0.01)  # 0.01 m/day recharge
    print(f"✓ GSPy function test: {result}")
    
except Exception as e:
    print(f"✗ GSPy function test failed: {e}")

print("\nSetup test completed!")