import textwrap
from typing import Generator, Union

import pytest

from ... import tools
from ...tools import DisplayOptions
from ...version4.input import (
    AlterBeam,
    AlterSetup,
    AlterField,
    Beam,
    Chicane,
    Corrector,
    Drift,
    Efield,
    Field,
    ImportBeam,
    ImportDistribution,
    ImportField,
    ImportTransformation,
    Lattice,
    Line,
    Marker,
    PhaseShifter,
    ProfileArray,
    ProfileConst,
    ProfileFile,
    ProfileGauss,
    ProfilePolynom,
    ProfileStep,
    Quadrupole,
    SequenceConst,
    SequencePolynom,
    SequencePower,
    SequenceRandom,
    Setup,
    Sponrad,
    Time,
    Track,
    Undulator,
    Wake,
    Write,
)
from ...version4.types import BeamlineElement, NameList


@pytest.fixture(
    params=[
        ("html", True),
        ("markdown", True),
        ("genesis", True),
        ("repr", True),
        ("html", False),
        ("markdown", False),
        ("genesis", False),
    ],
    ids=[
        "html-with-desc",
        "markdown-with-desc",
        "genesis-with-desc",
        "repr_pretty",
        "html-no-desc",
        "markdown-no-desc",
        "genesis-no-desc",
    ],
)
def display_options(
    request: pytest.FixtureRequest,
) -> Generator[DisplayOptions, None, None]:
    mode, desc = request.param
    opts = DisplayOptions(
        jupyter_render_mode=mode,
        console_render_mode=mode if mode != "html" else "genesis",
        include_description=desc,
    )
    tools.global_display_options = opts
    yield opts
    tools.global_display_options = DisplayOptions()


@pytest.mark.parametrize(
    "obj",
    [
        pytest.param(Chicane(), id="Chicane"),
        pytest.param(Corrector(), id="Corrector"),
        pytest.param(Drift(), id="Drift"),
        pytest.param(Marker(), id="Marker"),
        pytest.param(PhaseShifter(), id="PhaseShifter"),
        pytest.param(Quadrupole(), id="Quadrupole"),
        pytest.param(Undulator(), id="Undulator"),
        pytest.param(AlterBeam(), id="AlterBeam"),
        pytest.param(AlterSetup(), id="AlterSetup"),
        pytest.param(AlterField(), id="AlterField"),
        pytest.param(Beam(), id="Beam"),
        pytest.param(Efield(), id="Efield"),
        pytest.param(Field(), id="Field"),
        pytest.param(ImportBeam(), id="ImportBeam"),
        pytest.param(ImportDistribution(), id="ImportDistribution"),
        pytest.param(ImportField(), id="ImportField"),
        pytest.param(ImportTransformation(), id="ImportTransformation"),
        pytest.param(ProfileConst(label="label"), id="ProfileConst"),
        pytest.param(ProfileFile(label="label"), id="ProfileFile"),
        pytest.param(ProfileGauss(label="label"), id="ProfileGauss"),
        pytest.param(ProfilePolynom(label="label"), id="ProfilePolynom"),
        pytest.param(ProfileStep(label="label"), id="ProfileStep"),
        pytest.param(SequenceConst(label="label"), id="SequenceConst"),
        pytest.param(SequencePolynom(label="label"), id="SequencePolynom"),
        pytest.param(SequencePower(label="label"), id="SequencePower"),
        pytest.param(SequenceRandom(label="label"), id="SequenceRandom"),
        pytest.param(Setup(), id="Setup"),
        pytest.param(Sponrad(), id="Sponrad"),
        pytest.param(Time(), id="Time"),
        pytest.param(Track(), id="Track"),
        pytest.param(Wake(), id="Wake"),
        pytest.param(Write(), id="Write"),
        pytest.param(Lattice(), id="Lattice"),
        pytest.param(Line(), id="Line"),
        pytest.param(
            ProfileArray(label="label", xdata=[0], ydata=[0]), id="ProfileArray"
        ),
    ],
)
def test_render(
    display_options: DisplayOptions, obj: Union[BeamlineElement, NameList]
) -> None:
    print("Render options", display_options)
    print("Using __str__:")
    print(str(obj))
    assert "<pre" not in str(obj)
    print("Using _repr_html_:")
    print(obj._repr_html_())
    assert "<" in obj._repr_html_()


@pytest.mark.parametrize(
    "value, expected",
    [
        ("abcdef", "abcdef"),
        ("abcdefghijkl", "abcdef..."),
    ],
)
def test_truncate_string(
    value: str,
    expected: str,
) -> None:
    assert tools._truncated_string(value, 6) == expected


@pytest.mark.parametrize(
    "value, expected",
    [
        pytest.param({}, "{}", id="empty-dict"),
        pytest.param(
            {"a": 3},
            """{'a': 3}""",
            id="simple-dict",
        ),
        pytest.param(
            {"a": 3, "b": {"c": "d"}},
            """\
            {
              'a': 3,
              'b': {'c': 'd'},
            }
            """,
            id="simple-dict2",
        ),
        pytest.param(
            {"a": 3, "b": {"c": "d", "e": [1, 2, 3, 4]}},
            """\
            {
              'a': 3,
              'b': {
                'c': 'd',
                'e': [
                  1,
                  2,
                  3,
                  4,
                ],
              },
            }
            """,
            id="dict-with-list",
        ),
        pytest.param(
            {"a": 3, "b": {"c": "d", "e": (1, 2, 3, 4)}},
            """\
            {
              'a': 3,
              'b': {
                'c': 'd',
                'e': (
                  1,
                  2,
                  3,
                  4,
                ),
              },
            }
            """,
            id="dict-with-tuple",
        ),
    ],
)
def test_repr_pretty_dict(
    value,
    expected: str,
) -> None:
    expected = textwrap.dedent(expected)
    print("Expected:")
    print("---------")
    print(expected)
    print("---------")
    repr_ = tools.pretty_repr(value, newline_threshold=0)
    print("Repr:")
    print("---------")
    print(repr_)
    print("---------")
    assert repr_.rstrip() == expected.rstrip()
    assert eval(repr_) == eval(expected)


# WIP
# @pytest.mark.parametrize(
#     "value, expected",
#     [
#         pytest.param(
#             {},
#             "{}",
#             id="empty-dict"
#         ),
#     ]
# )
# def test_repr_pretty_element(
#     value,
#     expected: str,
# ) -> None:
#     expected = textwrap.dedent(expected)
#     print("Expected:")
#     print("---------")
#     print(expected)
#     print("---------")
#     repr_ = tools.pretty_repr(value, newline_threshold=0)
#     print("Repr:")
#     print("---------")
#     print(repr_)
#     print("---------")
#     assert repr_.rstrip() == expected.rstrip()
#     assert eval(repr_) == eval(expected)


def test_long_repr_smoke():
    import pathlib

    obj = Lattice(
        elements={
            "QHXH17": Quadrupole(
                label="QHXH17",
                L=0.101,
                k1=1.78,
            ),
            "QHXH18": Quadrupole(
                label="QHXH18",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH19": Quadrupole(
                label="QHXH19",
                L=0.101,
                k1=1.78,
            ),
            "QHXH20": Quadrupole(
                label="QHXH20",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH21": Quadrupole(
                label="QHXH21",
                L=0.101,
                k1=1.78,
            ),
            "QHXH22": Quadrupole(
                label="QHXH22",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH23": Quadrupole(
                label="QHXH23",
                L=0.101,
                k1=1.78,
            ),
            "QHXH24": Quadrupole(
                label="QHXH24",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH25": Quadrupole(
                label="QHXH25",
                L=0.101,
                k1=1.78,
            ),
            "QHXH26": Quadrupole(
                label="QHXH26",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH27": Quadrupole(
                label="QHXH27",
                L=0.101,
                k1=1.78,
            ),
            "QHXH28": Quadrupole(
                label="QHXH28",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH29": Quadrupole(
                label="QHXH29",
                L=0.101,
                k1=1.78,
            ),
            "QHXH30": Quadrupole(
                label="QHXH30",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH31": Quadrupole(
                label="QHXH31",
                L=0.101,
                k1=1.78,
            ),
            "QHXH32": Quadrupole(
                label="QHXH32",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH33": Quadrupole(
                label="QHXH33",
                L=0.101,
                k1=1.78,
            ),
            "QHXH34": Quadrupole(
                label="QHXH34",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH35": Quadrupole(
                label="QHXH35",
                L=0.101,
                k1=1.78,
            ),
            "QHXH36": Quadrupole(
                label="QHXH36",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH37": Quadrupole(
                label="QHXH37",
                L=0.101,
                k1=1.78,
            ),
            "QHXH38": Quadrupole(
                label="QHXH38",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH39": Quadrupole(
                label="QHXH39",
                L=0.101,
                k1=1.78,
            ),
            "QHXH40": Quadrupole(
                label="QHXH40",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH41": Quadrupole(
                label="QHXH41",
                L=0.101,
                k1=1.78,
            ),
            "QHXH42": Quadrupole(
                label="QHXH42",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH43": Quadrupole(
                label="QHXH43",
                L=0.101,
                k1=1.78,
            ),
            "QHXH44": Quadrupole(
                label="QHXH44",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH45": Quadrupole(
                label="QHXH45",
                L=0.101,
                k1=1.78,
            ),
            "QHXH46": Quadrupole(
                label="QHXH46",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH47": Quadrupole(
                label="QHXH47",
                L=0.101,
                k1=1.78,
            ),
            "QHXH48": Quadrupole(
                label="QHXH48",
                L=0.101,
                k1=-1.78,
            ),
            "QHXH49": Quadrupole(
                label="QHXH49",
                L=0.101,
                k1=1.78,
            ),
            "QHXH50": Quadrupole(
                label="QHXH50",
                L=0.101,
                k1=-1.78,
            ),
            "UMAHXH17": Undulator(
                label="UMAHXH17",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH18": Undulator(
                label="UMAHXH18",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH19": Undulator(
                label="UMAHXH19",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH20": Undulator(
                label="UMAHXH20",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH21": Undulator(
                label="UMAHXH21",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH22": Undulator(
                label="UMAHXH22",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH23": Undulator(
                label="UMAHXH23",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH25": Undulator(
                label="UMAHXH25",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH26": Undulator(
                label="UMAHXH26",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH27": Undulator(
                label="UMAHXH27",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH28": Undulator(
                label="UMAHXH28",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH29": Undulator(
                label="UMAHXH29",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH30": Undulator(
                label="UMAHXH30",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH31": Undulator(
                label="UMAHXH31",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH33": Undulator(
                label="UMAHXH33",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH34": Undulator(
                label="UMAHXH34",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH35": Undulator(
                label="UMAHXH35",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH36": Undulator(
                label="UMAHXH36",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH37": Undulator(
                label="UMAHXH37",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH38": Undulator(
                label="UMAHXH38",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH39": Undulator(
                label="UMAHXH39",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH40": Undulator(
                label="UMAHXH40",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH41": Undulator(
                label="UMAHXH41",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH42": Undulator(
                label="UMAHXH42",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH43": Undulator(
                label="UMAHXH43",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH44": Undulator(
                label="UMAHXH44",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH45": Undulator(
                label="UMAHXH45",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH46": Undulator(
                label="UMAHXH46",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH47": Undulator(
                label="UMAHXH47",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH48": Undulator(
                label="UMAHXH48",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH49": Undulator(
                label="UMAHXH49",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "UMAHXH50": Undulator(
                label="UMAHXH50",
                aw=1.7017,
                lambdau=0.026,
                nwig=130,
            ),
            "CORR00": Corrector(
                label="CORR00",
                L=0.001,
            ),
            "CORR01": Corrector(
                label="CORR01",
                L=0.001,
            ),
            "CORR02": Corrector(
                label="CORR02",
                L=0.001,
            ),
            "CORR03": Corrector(
                label="CORR03",
                L=0.001,
            ),
            "CORR04": Corrector(
                label="CORR04",
                L=0.001,
            ),
            "CORR05": Corrector(
                label="CORR05",
                L=0.001,
            ),
            "CORR06": Corrector(
                label="CORR06",
                L=0.001,
            ),
            "CORR07": Corrector(
                label="CORR07",
                L=0.001,
            ),
            "CORR08": Corrector(
                label="CORR08",
                L=0.001,
            ),
            "CORR09": Corrector(
                label="CORR09",
                L=0.001,
            ),
            "CORR10": Corrector(
                label="CORR10",
                L=0.001,
            ),
            "CORR11": Corrector(
                label="CORR11",
                L=0.001,
            ),
            "CORR12": Corrector(
                label="CORR12",
                L=0.001,
            ),
            "CORR13": Corrector(
                label="CORR13",
                L=0.001,
            ),
            "CORR14": Corrector(
                label="CORR14",
                L=0.001,
            ),
            "CORR15": Corrector(
                label="CORR15",
                L=0.001,
            ),
            "CORR16": Corrector(
                label="CORR16",
                L=0.001,
            ),
            "CORR17": Corrector(
                label="CORR17",
                L=0.001,
            ),
            "CORR18": Corrector(
                label="CORR18",
                L=0.001,
            ),
            "CORR19": Corrector(
                label="CORR19",
                L=0.001,
            ),
            "CORR20": Corrector(
                label="CORR20",
                L=0.001,
            ),
            "CORR21": Corrector(
                label="CORR21",
                L=0.001,
            ),
            "CORR22": Corrector(
                label="CORR22",
                L=0.001,
            ),
            "CORR23": Corrector(
                label="CORR23",
                L=0.001,
            ),
            "CORR24": Corrector(
                label="CORR24",
                L=0.001,
            ),
            "CORR25": Corrector(
                label="CORR25",
                L=0.001,
            ),
            "CORR26": Corrector(
                label="CORR26",
                L=0.001,
            ),
            "CORR27": Corrector(
                label="CORR27",
                L=0.001,
            ),
            "CORR28": Corrector(
                label="CORR28",
                L=0.001,
            ),
            "CORR29": Corrector(
                label="CORR29",
                L=0.001,
            ),
            "CORR30": Corrector(
                label="CORR30",
                L=0.001,
            ),
            "CORR31": Corrector(
                label="CORR31",
                L=0.001,
            ),
            "CORR32": Corrector(
                label="CORR32",
                L=0.001,
            ),
            "CORR33": Corrector(
                label="CORR33",
                L=0.001,
            ),
            "D1": Drift(
                label="D1",
                L=0.1335,
            ),
            "D2": Drift(
                label="D2",
                L=0.4615,
            ),
            "D3": Drift(
                label="D3",
                L=0.328,
            ),
            "D4": Drift(
                label="D4",
                L=3.4,
            ),
            "HXRSS": Chicane(
                label="HXRSS",
                L=4.55,
                lb=0.1,
            ),
            "HXR": Line(
                label="HXR",
                elements=[
                    "D1",
                    "UMAHXH17",
                    "D2",
                    "QHXH17",
                    "CORR00",
                    "D3",
                    "D1",
                    "UMAHXH18",
                    "D2",
                    "QHXH18",
                    "CORR01",
                    "D3",
                    "D1",
                    "UMAHXH19",
                    "D2",
                    "QHXH19",
                    "CORR02",
                    "D3",
                    "D1",
                    "UMAHXH20",
                    "D2",
                    "QHXH20",
                    "CORR03",
                    "D3",
                    "D1",
                    "UMAHXH21",
                    "D2",
                    "QHXH21",
                    "CORR04",
                    "D3",
                    "D1",
                    "UMAHXH22",
                    "D2",
                    "QHXH22",
                    "CORR05",
                    "D3",
                    "D1",
                    "UMAHXH23",
                    "D2",
                    "QHXH23",
                    "CORR06",
                    "D3",
                    "D1",
                    "HXRSS",
                    "D2",
                    "QHXH24",
                    "CORR07",
                    "D3",
                    "D1",
                    "UMAHXH25",
                    "D2",
                    "QHXH25",
                    "CORR08",
                    "D3",
                    "D1",
                    "UMAHXH26",
                    "D2",
                    "QHXH26",
                    "CORR09",
                    "D3",
                    "D1",
                    "UMAHXH27",
                    "D2",
                    "QHXH27",
                    "CORR10",
                    "D3",
                    "D1",
                    "UMAHXH28",
                    "D2",
                    "QHXH28",
                    "CORR11",
                    "D3",
                    "D1",
                    "UMAHXH29",
                    "D2",
                    "QHXH29",
                    "CORR12",
                    "D3",
                    "D1",
                    "UMAHXH30",
                    "D2",
                    "QHXH30",
                    "CORR13",
                    "D3",
                    "D1",
                    "UMAHXH31",
                    "D2",
                    "QHXH31",
                    "CORR14",
                    "D3",
                    "D1",
                    "D4",
                    "D2",
                    "QHXH32",
                    "CORR15",
                    "D3",
                    "D1",
                    "UMAHXH33",
                    "D2",
                    "QHXH33",
                    "CORR16",
                    "D3",
                    "D1",
                    "UMAHXH34",
                    "D2",
                    "QHXH34",
                    "CORR17",
                    "D3",
                    "D1",
                    "UMAHXH35",
                    "D2",
                    "QHXH35",
                    "CORR18",
                    "D3",
                    "D1",
                    "UMAHXH36",
                    "D2",
                    "QHXH36",
                    "CORR19",
                    "D3",
                    "D1",
                    "UMAHXH37",
                    "D2",
                    "QHXH37",
                    "CORR20",
                    "D3",
                    "D1",
                    "UMAHXH38",
                    "D2",
                    "QHXH38",
                    "CORR21",
                    "D3",
                    "D1",
                    "UMAHXH39",
                    "D2",
                    "QHXH39",
                    "CORR22",
                    "D3",
                    "D1",
                    "UMAHXH40",
                    "D2",
                    "QHXH40",
                    "CORR23",
                    "D3",
                    "D1",
                    "UMAHXH41",
                    "D2",
                    "QHXH41",
                    "CORR24",
                    "D3",
                    "D1",
                    "UMAHXH42",
                    "D2",
                    "QHXH42",
                    "CORR25",
                    "D3",
                    "D1",
                    "UMAHXH43",
                    "D2",
                    "QHXH43",
                    "CORR26",
                    "D3",
                    "D1",
                    "UMAHXH44",
                    "D2",
                    "QHXH44",
                    "CORR27",
                    "D3",
                    "D1",
                    "UMAHXH45",
                    "D2",
                    "QHXH45",
                    "CORR28",
                    "D3",
                    "D1",
                    "UMAHXH46",
                    "D2",
                    "QHXH46",
                    "CORR29",
                    "D3",
                    "D1",
                    "UMAHXH47",
                    "D2",
                    "QHXH47",
                    "CORR30",
                    "D3",
                    "D1",
                    "UMAHXH48",
                    "D2",
                    "QHXH48",
                    "CORR31",
                    "D3",
                    "D1",
                    "UMAHXH49",
                    "D2",
                    "QHXH49",
                    "CORR32",
                    "D3",
                    "D1",
                    "UMAHXH50",
                    "D2",
                    "QHXH50",
                    "CORR33",
                    "D3",
                ],
            ),
            "LCLS2_HXR_U1": Line(
                label="LCLS2_HXR_U1",
                elements=[
                    "D1",
                    "UMAHXH17",
                    "D2",
                    "QHXH17",
                    "CORR00",
                    "D3",
                    "D1",
                    "UMAHXH18",
                    "D2",
                    "QHXH18",
                    "CORR01",
                    "D3",
                    "D1",
                    "UMAHXH19",
                    "D2",
                    "QHXH19",
                    "CORR02",
                    "D3",
                    "D1",
                    "UMAHXH20",
                    "D2",
                    "QHXH20",
                    "CORR03",
                    "D3",
                    "D1",
                    "UMAHXH21",
                    "D2",
                    "QHXH21",
                    "CORR04",
                    "D3",
                    "D1",
                    "UMAHXH22",
                    "D2",
                    "QHXH22",
                    "CORR05",
                    "D3",
                    "D1",
                    "UMAHXH23",
                    "D2",
                    "QHXH23",
                    "CORR06",
                    "D3",
                ],
            ),
            "LCLS2_HXR_U2": Line(
                label="LCLS2_HXR_U2",
                elements=[
                    "D1",
                    "UMAHXH25",
                    "D2",
                    "QHXH25",
                    "CORR08",
                    "D3",
                    "D1",
                    "UMAHXH26",
                    "D2",
                    "QHXH26",
                    "CORR09",
                    "D3",
                    "D1",
                    "UMAHXH27",
                    "D2",
                    "QHXH27",
                    "CORR10",
                    "D3",
                    "D1",
                    "UMAHXH28",
                    "D2",
                    "QHXH28",
                    "CORR11",
                    "D3",
                    "D1",
                    "UMAHXH29",
                    "D2",
                    "QHXH29",
                    "CORR12",
                    "D3",
                    "D1",
                    "UMAHXH30",
                    "D2",
                    "QHXH30",
                    "CORR13",
                    "D3",
                    "D1",
                    "UMAHXH31",
                    "D2",
                    "QHXH31",
                    "CORR14",
                    "D3",
                    "D1",
                    "D4",
                    "D2",
                    "QHXH32",
                    "CORR15",
                    "D3",
                    "D1",
                    "UMAHXH33",
                    "D2",
                    "QHXH33",
                    "CORR16",
                    "D3",
                    "D1",
                    "UMAHXH34",
                    "D2",
                    "QHXH34",
                    "CORR17",
                    "D3",
                    "D1",
                    "UMAHXH35",
                    "D2",
                    "QHXH35",
                    "CORR18",
                    "D3",
                    "D1",
                    "UMAHXH36",
                    "D2",
                    "QHXH36",
                    "CORR19",
                    "D3",
                    "D1",
                    "UMAHXH37",
                    "D2",
                    "QHXH37",
                    "CORR20",
                    "D3",
                    "D1",
                    "UMAHXH38",
                    "D2",
                    "QHXH38",
                    "CORR21",
                    "D3",
                    "D1",
                    "UMAHXH39",
                    "D2",
                    "QHXH39",
                    "CORR22",
                    "D3",
                    "D1",
                    "UMAHXH40",
                    "D2",
                    "QHXH40",
                    "CORR23",
                    "D3",
                    "D1",
                    "UMAHXH41",
                    "D2",
                    "QHXH41",
                    "CORR24",
                    "D3",
                    "D1",
                    "UMAHXH42",
                    "D2",
                    "QHXH42",
                    "CORR25",
                    "D3",
                    "D1",
                    "UMAHXH43",
                    "D2",
                    "QHXH43",
                    "CORR26",
                    "D3",
                    "D1",
                    "UMAHXH44",
                    "D2",
                    "QHXH44",
                    "CORR27",
                    "D3",
                    "D1",
                    "UMAHXH45",
                    "D2",
                    "QHXH45",
                    "CORR28",
                    "D3",
                    "D1",
                    "UMAHXH46",
                    "D2",
                    "QHXH46",
                    "CORR29",
                    "D3",
                    "D1",
                    "UMAHXH47",
                    "D2",
                    "QHXH47",
                    "CORR30",
                    "D3",
                    "D1",
                    "UMAHXH48",
                    "D2",
                    "QHXH48",
                    "CORR31",
                    "D3",
                    "D1",
                    "UMAHXH49",
                    "D2",
                    "QHXH49",
                    "CORR32",
                    "D3",
                    "D1",
                    "UMAHXH50",
                    "D2",
                    "QHXH50",
                    "CORR33",
                    "D3",
                ],
            ),
        },
        filename=pathlib.Path(
            "/Users/klauer/Repos/lume-genesis/docs/examples/genesis4/data/basic4/hxr.lat"
        ),
    )

    print(repr(obj))
