from pathlib import Path

# Import test utilities
from test_utils.logging import get_test_logger

# Initialize logger
logger = get_test_logger(__name__)

from rompy_schism.namelists import NML
from rompy_schism.namelists.param import Core


def test_basic():
    outdir = Path("testbasic")
    nml = NML(param=dict(core=Core()))
    outdir.mkdir(exist_ok=True)
    nml.write_nml(outdir)


# def test_csiro_nml():
#     outdir = Path("testref")
#     nml = NML(
#         param=Param(
#             core=Core(
#                 ipre=0,
#                 ibc=1,
#                 ibtp=0,
#                 rnday=120,
#                 dt=120.0,
#                 msc2=36,
#                 mdc2=36,
#                 ntracer_gen=2,
#                 ntracer_age=4,
#                 sed_class=5,
#                 eco_class=27,
#                 nspool=30,
#                 ihfskip=720,
#             ),
#             opt=Opt(
#                 ipre2=0,
#                 start_year=2021,
#                 start_month=8,
#                 start_day=1,
#                 start_hour=0,
#                 utc_start=0,
#                 ics=2,
#                 ihot=0,
#                 ieos_type=0,
#                 ieos_pres=0,
#                 eos_a=-0.1,
#                 eos_b=1001.0,
#                 nramp=1,
#                 dramp=1.0,
#                 nrampbc=0,
#                 drampbc=1.0,
#                 iupwind_mom=0,
#                 indvel=0,
#                 ihorcon=0,
#                 hvis_coef0=0.025,
#                 ishapiro=1,
#                 shapiro0=0.5,
#                 niter_shap=1,
#                 thetai=0.8,
#                 icou_elfe_wwm=1,
#                 nstep_wwm=3,
#                 iwbl=0,
#                 hmin_radstress=1.0,
#                 nrampwafo=1,
#                 drampwafo=1.0,
#                 turbinj=0.15,
#                 imm=0,
#                 ibdef=10,
#                 slam0=120.0,
#                 sfea0=-29.0,
#                 iunder_deep=0,
#                 h1_bcc=50.0,
#                 h2_bcc=100.0,
#                 hw_depth="1.0e6",
#                 hw_ratio=0.5,
#                 ihydraulics=0,
#                 if_source=0,
#                 nramp_ss=1,
#                 dramp_ss=2,
#                 ihdif=0,
#                 nchi=-1,
#                 dzb_min=0.5,
#                 hmin_man=1.0,
#                 ncor=1,
#                 rlatitude=-29,
#                 coricoef=0,
#                 ic_elev=0,
#                 nramp_elev=1,
#                 inv_atm_bnd=1,
#                 prmsl_ref=101325.0,
#                 # flag_ic(3) = 0 ,
#                 # flag_ic(5) = 0,
#                 # flag_ic(6) = 0,
#                 # flag_ic(7) = 0,
#                 # flag_ic(8) = 0,
#                 # flag_ic(9) = 0,
#                 # flag_ic(10) = 0,
#                 # flag_ic(11) = 0,
#                 # flag_ic(12) = 0,
#                 # gen_wsett="1.0e-4", #TODO need to investigate
#                 gen_wsett="1",  # TODO need to investigate this - wants an int
#                 ibcc_mean=0,
#                 rmaxvel=20.0,
#                 velmin_btrack="1.0e-4",
#                 btrack_nudge="9.013e-3",
#                 ihhat=1,
#                 inunfl=0,
#                 h0=0.01,
#                 shorewafo=1,
#                 moitn0=50,
#                 mxitn0=1500,
#                 rtol0="1.0e-12",
#                 nadv=2,
#                 dtb_max=30.0,
#                 dtb_min=10.0,
#                 inter_mom=1,
#                 kr_co=1,
#                 itr_met=3,
#                 h_tvd=5.0,
#                 eps1_tvd_imp="1.0e-4",
#                 eps2_tvd_imp="1.0e-14",
#                 ielm_transport=0,
#                 max_subcyc=10,
#                 ip_weno=2,
#                 courant_weno=0.5,
#                 nquad=2,
#                 ntd_weno=1,
#                 epsilon1="1.0e-3",
#                 epsilon2="1.0e-10",
#                 i_prtnftl_weno=0,
#                 epsilon3="1.0e-25",
#                 ielad_weno=0,
#                 small_elad="1.0e-4",
#                 nws=2,
#                 wtiminc=3600,
#                 nrampwind=1,
#                 drampwind=1.0,
#                 iwind_form=1,
#                 impose_net_flux=0,
#                 ihconsv=0,
#                 isconsv=0,
#                 itur=3,
#                 dfv0="1.0e-6",
#                 dfh0="1.0e-6",
#                 mid="KL",
#                 stab="KC",
#                 xlsc0=0.7,
#                 inu_elev=0,
#                 inu_uv=0,
#                 # inu_tr(1) = 0,
#                 # inu_tr(2) = 0,
#                 # inu_tr(3) = 0,
#                 # inu_tr(4) = 0,
#                 # inu_tr(5) = 0,
#                 # inu_tr(6) = 0,
#                 # inu_tr(7) = 0,
#                 # inu_tr(8) = 0,
#                 # inu_tr(9) = 0,
#                 # inu_tr(10) = 0,
#                 # inu_tr(11) = 0,
#                 # inu_tr(12) = 0,
#                 vnh1=400,
#                 vnf1=0.0,
#                 vnh2=500,
#                 vnf2=0.0,
#                 step_nu_tr=86400.0,
#                 h_bcc1=100.0,
#                 s1_mxnbt=0.5,
#                 s2_mxnbt=3.0,
#                 iharind=0,
#                 iflux=0,
#                 izonal5=0,
#                 ibtrack_test=0,
#                 irouse_test=0,
#                 slr_rate=120.0,
#                 isav=0,
#                 rearth_pole=6378206.4,
#                 rearth_eq=6378206.4,
#                 shw="4184.d0",
#                 rho0="1000.d0",
#                 vclose_surf_frac=1.0,
#                 # iadjust_mass_consv0(1)=0 !T
#                 # iadjust_mass_consv0(2)=0 !S
#                 # iadjust_mass_consv0(3)=0 !GEN
#                 # iadjust_mass_consv0(4)=0 !AGE
#                 # iadjust_mass_consv0(5)=0 !SED3D (code won't allow non-0 for this module)
#                 # iadjust_mass_consv0(6)=0 !EcoSim
#                 # iadjust_mass_consv0(7)=0 !ICM
#                 # iadjust_mass_consv0(8)=0 !CoSiNE
#                 # iadjust_mass_consv0(9)=0 !Feco
#                 # iadjust_mass_consv0(10)=0 !TIMOR
#                 # iadjust_mass_consv0(11)=0 !FABM
#                 # iadjust_mass_consv0(12)=0 !DVD (must=0)
#             ),
#             schout=Schout(
#                 nhot=0,
#                 nhot_write=22320.0,
#                 iout_sta=0,
#                 nspool_sta=30,
#                 # iof_hydro(1) = 1,
#                 # iof_hydro(2) = 0,
#                 # iof_hydro(3) = 0,
#                 # iof_hydro(4) = 0,
#                 # iof_hydro(5) = 0,
#                 # iof_hydro(6) = 0,
#                 # iof_hydro(7) = 0,
#                 # iof_hydro(8) = 0,
#                 # iof_hydro(9) = 0,
#                 # iof_hydro(10) = 0,
#                 # iof_hydro(11) = 0,
#                 # iof_hydro(12) = 0,
#                 # iof_hydro(13) = 0,
#                 # iof_hydro(14) = 0,
#                 # iof_hydro(15) = 0,
#                 # iof_hydro(16) = 1,
#                 # iof_hydro(17) = 0,
#                 # iof_hydro(18) = 0,
#                 # iof_hydro(19) = 0,
#                 # iof_hydro(20) = 0,
#                 # iof_hydro(21) = 0,
#                 # iof_hydro(22) = 0,
#                 # iof_hydro(23) = 0,
#                 # iof_hydro(24) = 0,
#                 # iof_hydro(25) = 0,
#                 # iof_hydro(26) = 0,
#                 # iof_hydro(27) = 0,
#                 # iof_hydro(28) = 0,
#                 # iof_hydro(29) = 0,
#                 # iof_hydro(30) = 0,
#                 # iof_wwm(1)  = 1,
#                 # iof_wwm(2)  = 1,
#                 # iof_wwm(3)  = 0,
#                 # iof_wwm(4)  = 0,
#                 # iof_wwm(5)  = 0,
#                 # iof_wwm(6)  = 0,
#                 # iof_wwm(7)  = 0,
#                 # iof_wwm(8) = 1,
#                 # iof_wwm(9) = 1,
#                 # iof_wwm(10) = 0,
#                 # iof_wwm(11) = 0,
#                 # iof_wwm(12) = 0,
#                 # iof_wwm(13) = 0,
#                 # iof_wwm(14) = 0,
#                 # iof_wwm(15) = 0,
#                 # iof_wwm(16) = 1,
#                 # iof_wwm(17) = 1,
#                 # iof_wwm(18) = 1,
#                 # iof_wwm(19) = 0,
#                 # iof_wwm(20) = 0,
#                 # iof_wwm(21) = 0,
#                 # iof_wwm(22) = 0,
#                 # iof_wwm(23) = 0,
#                 # iof_wwm(24) = 0,
#                 # iof_wwm(25) = 0,
#                 # iof_wwm(26) = 0,
#                 #
#                 # iof_wwm(27) = 0,
#                 # iof_wwm(28) = 0 !Total wave energy dissipation rate by depth-induced breaking (W/m2) @nodes {wave_sbrtot}  2D
#                 # iof_wwm(29) = 0 !Total wave energy dissipation rate by bottom friction (W/m2) @nodes {wave_sbftot} 2D
#                 # iof_wwm(30) = 0 !Total wave energy dissipation rate by whitecapping (W/m2) @nodes {wave_sdstot} 2D
#             ),
#         )
#     )
#     outdir.mkdir(exist_ok=True)
#     nml.write_nml(outdir)
