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

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

metadata = {
    "protocolName": "Datum Labware Alignment Check — DL-VACU24-PA12",
    "author": "Datum Labware <lena@datumlabware.com>",
    "description": "Dry-run coordinate verification for Datum Labware 24 Well Clinical Rack with 13x75 mm Blood 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_24_tuberack_vacutainer_13x75mm", "5")
    pipette = protocol.load_instrument("p300_single_gen2", "right")

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

    protocol.comment("Datum verification complete.")
