"""
Datum Labware — 60-Second Alignment & Datum Verification Protocol
SKU: DL-EPP15-PA12 | Load Name: datum_15_tuberack_eppendorf_5ml_snapcap

How to use:
1. Import `datum_15_tuberack_eppendorf_5ml_snapcap.json` in the Opentrons App -> Labware -> Import.
2. Place your Datum Labware rack (DL-EPP15-PA12) in Deck Slot C2 (Flex) or Slot 5 (OT-2) with EMPTY, UNCAPPED tubes in A1 and C5.
3. Attach a single-channel pipette with one tip and run this dry verification check.
   The robot pauses for 5 seconds at:
   - A1 top center (Z = tube rim + 2.0 mm)
   - A1 safe bottom clearance (Z = well bottom + 2.0 mm)
   - C5 top center (Z = tube rim + 2.0 mm)
"""
from opentrons import protocol_api

metadata = {
    "protocolName": "Datum Labware Alignment Check — DL-EPP15-PA12",
    "author": "Datum Labware <lena@datumlabware.com>",
    "description": "Dry-run coordinate verification for Datum Labware 15 Well Rack with Eppendorf 5 mL Tube",
}

requirements = {"robotType": "OT-2", "apiLevel": "2.19"}


def run(protocol: protocol_api.ProtocolContext):
    # Change slot to 'C2' and robotType to 'Flex' if running on Opentrons Flex
    rack = protocol.load_labware("datum_15_tuberack_eppendorf_5ml_snapcap", "5")
    pipette = protocol.load_instrument("p300_single_gen2", "right")

    protocol.comment("Verifying Datum Labware DL-EPP15-PA12: moving to A1 top + 2mm")
    pipette.move_to(rack["A1"].top(z=2.0))
    protocol.delay(seconds=5)

    protocol.comment("Moving to A1 bottom + 2mm safe clearance")
    pipette.move_to(rack["A1"].bottom(z=2.0))
    protocol.delay(seconds=5)

    protocol.comment("Moving to opposite diagonal well C5 top + 2mm")
    pipette.move_to(rack["C5"].top(z=2.0))
    protocol.delay(seconds=5)

    protocol.comment("Datum verification complete.")
