from pathlib import Path
import textwrap


def modules_legacy_python_protocol_file(tmp_path: Path) -> Path:
    """Get an on-disk, minimal fixture of legacy python protocol w/ modules."""
    path = tmp_path / "protocol-name.py"
    path.write_text(
        textwrap.dedent(
            """
            # my protocol
            metadata = {
                "apiLevel": "2.11",
            }
            def run(ctx):
                tip_rack = ctx.load_labware(
                    load_name="opentrons_96_tiprack_300ul",
                    location="2",
                )
                temp_module = ctx.load_module(
                    module_name="temperature module",
                    location="3"
                )
                mag_module = ctx.load_module(
                    module_name="magnetic module",
                    location="6"
                )
                thermocycler = ctx.load_module(
                    module_name="thermocycler"
                )
                heater_shaker = ctx.load_module(
                    module_name="heaterShakerModuleV1",
                    location="1"
                )
            """
        )
    )

    return path