///|
pub fn water() -> Component {
  Component::new(
    name="water",
    formula="H2O",
    cas="7732-18-5",
    antoine=Antoine::new(
      a=8.07131,
      b=1730.63,
      c=233.426,
      t_min_k=274.0,
      t_max_k=373.0,
      note="NIST Chemistry WebBook Antoine constants, pressure in mmHg, temperature in C.",
    ),
  )
}

///|
pub fn ethanol() -> Component {
  Component::new(
    name="ethanol",
    formula="C2H6O",
    cas="64-17-5",
    antoine=Antoine::new(
      a=8.20417,
      b=1642.89,
      c=230.300,
      t_min_k=276.5,
      t_max_k=351.5,
      note="NIST Chemistry WebBook Antoine constants, pressure in mmHg, temperature in C.",
    ),
  )
}

///|
pub fn benzene() -> Component {
  Component::new(
    name="benzene",
    formula="C6H6",
    cas="71-43-2",
    antoine=Antoine::new(
      a=6.90565,
      b=1211.033,
      c=220.790,
      t_min_k=280.0,
      t_max_k=377.0,
      note="NIST Chemistry WebBook Antoine constants, pressure in mmHg, temperature in C.",
    ),
  )
}

///|
pub fn toluene() -> Component {
  Component::new(
    name="toluene",
    formula="C7H8",
    cas="108-88-3",
    antoine=Antoine::new(
      a=6.95464,
      b=1344.800,
      c=219.480,
      t_min_k=280.0,
      t_max_k=410.0,
      note="NIST Chemistry WebBook Antoine constants, pressure in mmHg, temperature in C.",
    ),
  )
}

///|
pub fn acetone() -> Component {
  Component::new(
    name="acetone",
    formula="C3H6O",
    cas="67-64-1",
    antoine=Antoine::new(
      a=7.02447,
      b=1161.0,
      c=224.0,
      t_min_k=259.0,
      t_max_k=329.0,
      note="DDBST public Antoine table style constants; verify before design use.",
    ),
  )
}

///|
pub fn chloroform() -> Component {
  Component::new(
    name="chloroform",
    formula="CHCl3",
    cas="67-66-3",
    antoine=Antoine::new(
      a=6.95465,
      b=1170.966,
      c=226.232,
      t_min_k=260.0,
      t_max_k=334.0,
      note="DDBST public Antoine table style constants; verify before design use.",
    ),
  )
}

///|
pub fn methanol() -> Component {
  Component::new(
    name="methanol",
    formula="CH4O",
    cas="67-56-1",
    antoine=Antoine::new(
      a=8.08097,
      b=1582.271,
      c=239.726,
      t_min_k=273.0,
      t_max_k=337.0,
      note="NIST Chemistry WebBook SRD 69 style Antoine constants; pressure in mmHg.",
    ),
  )
}

///|
pub fn ethyl_acetate() -> Component {
  Component::new(
    name="ethyl acetate",
    formula="C4H8O2",
    cas="141-78-6",
    antoine=Antoine::new(
      a=7.10179,
      b=1244.951,
      c=217.881,
      t_min_k=291.0,
      t_max_k=345.0,
      note="NIST Chemistry WebBook SRD 69 style Antoine constants; pressure in mmHg.",
    ),
  )
}

///|
pub fn n_hexane() -> Component {
  Component::new(
    name="n-hexane",
    formula="C6H14",
    cas="110-54-3",
    antoine=Antoine::new(
      a=6.88555,
      b=1175.817,
      c=224.867,
      t_min_k=286.0,
      t_max_k=342.0,
      note="NIST Chemistry WebBook SRD 69 style Antoine constants; pressure in mmHg.",
    ),
  )
}

///|
pub fn cyclohexane() -> Component {
  Component::new(
    name="cyclohexane",
    formula="C6H12",
    cas="110-82-7",
    antoine=Antoine::new(
      a=6.84930,
      b=1203.835,
      c=222.650,
      t_min_k=280.0,
      t_max_k=353.0,
      note="NIST Chemistry WebBook SRD 69 style Antoine constants; pressure in mmHg.",
    ),
  )
}

///|
pub fn benzene_toluene() -> Array[Component] {
  [benzene(), toluene()]
}

///|
pub fn ethanol_water() -> Array[Component] {
  [ethanol(), water()]
}

///|
pub fn acetone_chloroform() -> Array[Component] {
  [acetone(), chloroform()]
}

///|
pub fn methanol_water() -> Array[Component] {
  [methanol(), water()]
}

///|
pub fn hexane_cyclohexane_benzene() -> Array[Component] {
  [n_hexane(), cyclohexane(), benzene()]
}

///|
pub fn pure_pressure_benchmarks() -> Array[PurePressureBenchmark] raise VleError {
  [
    PurePressureBenchmark::new(
      component="water",
      temperature_k=373.15,
      pressure_bar=1.01325,
      source="NIST Chemistry WebBook SRD 69, water saturation point at 100 C.",
      tolerance=0.012,
    ),
    PurePressureBenchmark::new(
      component="benzene",
      temperature_k=298.15,
      pressure_bar=0.1260,
      source="NIST Chemistry WebBook SRD 69, benzene Antoine/reference data.",
      tolerance=0.004,
    ),
    PurePressureBenchmark::new(
      component="toluene",
      temperature_k=298.15,
      pressure_bar=0.0370,
      source="NIST Chemistry WebBook SRD 69, toluene Antoine/reference data.",
      tolerance=0.002,
    ),
    PurePressureBenchmark::new(
      component="ethanol",
      temperature_k=351.45,
      pressure_bar=1.01325,
      source="NIST Chemistry WebBook SRD 69, normal boiling point reference.",
      tolerance=0.018,
    ),
    PurePressureBenchmark::new(
      component="methanol",
      temperature_k=337.85,
      pressure_bar=1.01325,
      source="NIST Chemistry WebBook SRD 69, normal boiling point reference.",
      tolerance=0.018,
    ),
  ]
}

///|
pub fn benzene_toluene_benchmarks() -> Array[BenchmarkPoint] raise VleError {
  let source = "Benzene + toluene isobaric VLE, 101.325 kPa, DECHEMA-style public benchmark transcription; values are rounded for regression tests."
  [
    BenchmarkPoint::new(
      system="benzene/toluene",
      temperature_k=383.75,
      pressure_bar=1.01325,
      liquid=[0.0, 1.0],
      vapor=[0.0, 1.0],
      source~,
      tolerance=0.025,
    ),
    BenchmarkPoint::new(
      system="benzene/toluene",
      temperature_k=371.15,
      pressure_bar=1.01325,
      liquid=[0.25, 0.75],
      vapor=[0.47, 0.53],
      source~,
      tolerance=0.025,
    ),
    BenchmarkPoint::new(
      system="benzene/toluene",
      temperature_k=364.65,
      pressure_bar=1.01325,
      liquid=[0.50, 0.50],
      vapor=[0.71, 0.29],
      source~,
      tolerance=0.025,
    ),
    BenchmarkPoint::new(
      system="benzene/toluene",
      temperature_k=358.15,
      pressure_bar=1.01325,
      liquid=[0.75, 0.25],
      vapor=[0.88, 0.12],
      source~,
      tolerance=0.025,
    ),
    BenchmarkPoint::new(
      system="benzene/toluene",
      temperature_k=353.25,
      pressure_bar=1.01325,
      liquid=[1.0, 0.0],
      vapor=[1.0, 0.0],
      source~,
      tolerance=0.025,
    ),
  ]
}

///|
pub fn ethanol_water_wilson() -> ActivityModel {
  ActivityModel::Wilson(
    WilsonBinary::new(
      lambda12=0.1559,
      lambda21=0.7981,
      source="Illustrative ethanol-water Wilson parameters adapted from common DECHEMA-style examples; not for plant design.",
    ),
  )
}

///|
pub fn acetone_chloroform_nrtl() -> ActivityModel {
  ActivityModel::Nrtl(
    NrtlBinary::new(
      tau12=0.35,
      tau21=0.62,
      alpha=0.30,
      source="Illustrative NRTL parameters for regression and API examples; not for plant design.",
    ),
  )
}

///|
pub fn benzene_toluene_uniquac() -> ActivityModel {
  ActivityModel::Uniquac(
    UniquacBinary::new(
      comp1=UniquacComponent::new(r=3.1878, q=2.4000),
      comp2=UniquacComponent::new(r=3.9228, q=2.9680),
      tau12=1.02,
      tau21=0.98,
      source="UNIQUAC size/surface constants from Abrams-Prausnitz convention; taus are near-ideal demonstration values.",
    ),
  )
}

///|
pub fn benzoic_acid_in_water_demo() -> SolidSolubility {
  SolidSolubility::new(
    component=Component::new(
      name="benzoic acid",
      formula="C7H6O2",
      cas="65-85-0",
      antoine=Antoine::new(
        a=0.0,
        b=0.0,
        c=1.0,
        t_min_k=273.15,
        t_max_k=450.0,
        note="solid-solubility demonstration record; vapor-pressure fields are unused by this SLE example",
      ),
    ),
    solvent=water(),
    temperature_k=298.15,
    mole_fraction=0.00034,
    source="CRC Handbook-style public solubility example converted approximately to mole fraction.",
  )
}