"""
Datum Labware — 60-Second Alignment & Datum Verification Protocol
SKU: DL-COMBO26-POM | Load Name: datum_26_tuberack_6x20ml_20x2ml_combo

How to use:
1. Import `datum_26_tuberack_6x20ml_20x2ml_combo.json` in the Opentrons App -> Labware -> Import.
2. Place your Datum Labware rack (DL-COMBO26-POM) in Deck Slot C2 (Flex) or Slot 5 (OT-2) with EMPTY, UNCAPPED tubes in A1 and E6.
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)
   - E6 top center (Z = tube rim + 2.0 mm)
"""
from opentrons import protocol_api

metadata = {
    "protocolName": "Datum Labware Alignment Check — DL-COMBO26-POM",
    "author": "Datum Labware <lena@datumlabware.com>",
    "description": "Dry-run coordinate verification for Datum Labware 26 Well Dual-Zone Rack (6x 20 mL Reagent + 20x 2 mL HPLC)",
}

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_26_tuberack_6x20ml_20x2ml_combo", "5")
    pipette = protocol.load_instrument("p300_single_gen2", "right")

    protocol.comment("Verifying Datum Labware DL-COMBO26-POM: 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 E6 top + 2mm")
    pipette.move_to(rack["E6"].top(z=2.0))
    protocol.delay(seconds=5)

    protocol.comment("Datum verification complete.")
