{
  "ursId": "URS-032",
  "title": "Traceability for product lots, shipments, and inventory movements",
  "timestamp": "2026-08-03T23:03:22.458Z",
  "durationMs": 230965,
  "config": {
    "inboxUrl": "http://localhost:34967",
    "dbHost": "localhost",
    "dbPort": 46337,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Lot traceability details",
      "status": "pass",
      "description": "Step 1: Lot traceability details",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-01-lot-details.png"
      ],
      "explanation": "The lot-controlled product NEURO-DEVICE-001 (an implantable device) carries lot policy \"approved\" with a controlled allowed-lot list (LOT-2025-001234 for the warehouse, LOT-2025-005678 for the trunk), establishing that lots are first-class, controlled data on the product.",
      "startedAt": "2026-08-03T23:03:29.242Z",
      "finishedAt": "2026-08-03T23:03:29.242Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-01-lot-details.webm"
    },
    {
      "name": "Step 2: Catalog & account",
      "status": "pass",
      "description": "Step 2: Catalog & account",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-02-catalog-entry.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-02-sales-account.png"
      ],
      "explanation": "The product-catalog entry has billing and ordering enabled, and the ROSS sales account carries effective approved pricing plus the \"holds owned stock\" setting that makes it eligible for direct orders and hospital-stock bill-only orders.",
      "startedAt": "2026-08-03T23:03:35.406Z",
      "finishedAt": "2026-08-03T23:03:39.942Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-02-catalog-account.webm"
    },
    {
      "name": "Step 3: Baseline inventory",
      "status": "pass",
      "description": "Step 3: Baseline inventory",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-03-baseline-inventory.png"
      ],
      "explanation": "The warehouse lot LOT-2025-001234 is on hand at the Main Warehouse (ROSS-001) before any order activity — the baseline that makes the later increase and decrease conclusively attributable to the order flows.",
      "startedAt": "2026-08-03T23:03:45.066Z",
      "finishedAt": "2026-08-03T23:03:45.066Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-03-baseline-inventory.webm"
    },
    {
      "name": "Step 4: Create direct order",
      "status": "pass",
      "description": "Step 4: Create direct order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-04-destination.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-04-product-quantity.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-04-submitted.png"
      ],
      "explanation": "A Corveta sales rep orders the product for the ROSS account. Because the account holds owned stock, the order is created as a DIRECT order.",
      "startedAt": "2026-08-03T23:03:58.697Z",
      "finishedAt": "2026-08-03T23:04:05.598Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-04-create-direct-order.webm"
    },
    {
      "name": "Step 5: Approve order",
      "status": "pass",
      "description": "Step 5: Approve order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-05-approval-dialog.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-05-approved-no-lots.png"
      ],
      "explanation": "The manufacturer approves the order, creating the fulfillment order. The order detail lists the product but shows no lot yet — lots are stamped by the warehouse at shipment time. The \"Direct Order Created\" notification email names the product being fulfilled.",
      "expectedEmailTemplates": [
        "Direct Order Created"
      ],
      "startedAt": "2026-08-03T23:04:15.220Z",
      "finishedAt": "2026-08-03T23:04:22.551Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-05-approve-order.webm"
    },
    {
      "name": "Step 6: Import shipping notice",
      "status": "pass",
      "description": "Step 6: Import shipping notice",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-06-upload-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-06-import-complete.png"
      ],
      "explanation": "The warehouse ASN is imported through the real /packages/upload pipeline: the notice lists the product SKU with its lot (LOT-2025-001234) against the fulfillment order number, with carrier \"demo\" and a magic DFX tracking number that simulates the carrier feed.",
      "startedAt": "2026-08-03T23:05:06.034Z",
      "finishedAt": "2026-08-03T23:05:11.073Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-06-import-shipping-notice.webm"
    },
    {
      "name": "Step 7: Lot pages",
      "status": "pass",
      "description": "Step 7: Lot pages",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-07-package-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-07-fulfillment-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-07-order-line.png"
      ],
      "explanation": "The imported lot is now traceable across the chain: the shipping package detail (the lot on the shipped item, against the fulfillment order number) and the fulfillment order detail (the SKU with its shipped lot, \"NEURO-DEVICE-001: LOT LOT-2025-001234\"), for the same order request.",
      "startedAt": "2026-08-03T23:05:16.156Z",
      "finishedAt": "2026-08-03T23:05:19.050Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-07-lot-pages.webm"
    },
    {
      "name": "Step 8: Delivery & inventory increase",
      "status": "pass",
      "description": "Step 8: Delivery & inventory increase",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-08-package-delivered.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-08-inventory-increased.png"
      ],
      "explanation": "The demo tracking sequence delivers the package through the same handler a real carrier webhook uses, firing the auto-add-inventory hook: the warehouse lot rises by exactly the shipped quantity, proving received direct-order stock increases inventory with the correct lot.",
      "startedAt": "2026-08-03T23:05:30.318Z",
      "finishedAt": "2026-08-03T23:05:31.832Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-08-delivery-increase.webm"
    },
    {
      "name": "Step 9: Bill-only lot entry",
      "status": "pass",
      "description": "Step 9: Bill-only lot entry",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-09-lot-required.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-09-missing-lot-rejected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-09-approved-lot-options.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-09-submitted.png"
      ],
      "explanation": "The bill-only form asks for a lot for the tracked product and validates it: continuing without a lot is rejected, and the dropdown offers only the product's approved lots. The order is submitted with LOT-2025-001234 sourced from the ROSS (Hospital Stock) inventory.",
      "startedAt": "2026-08-03T23:05:51.958Z",
      "finishedAt": "2026-08-03T23:06:02.829Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-09-bill-only-lot.webm"
    },
    {
      "name": "Step 10: Bill-only lots & decrement",
      "status": "pass",
      "description": "Step 10: Bill-only lots & decrement",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-10-billing-order-lot.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-10-inventory-decremented.png"
      ],
      "explanation": "The submitted bill-only order shows the product line with its lot, and the same lot decrements at the same location — consuming the exact unit the direct order delivered, which closes the warehouse traceability loop.",
      "startedAt": "2026-08-03T23:06:07.493Z",
      "finishedAt": "2026-08-03T23:06:08.781Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-10-bill-only-decrement.webm"
    },
    {
      "name": "Step 11: Trunk bill-only",
      "status": "pass",
      "description": "Step 11: Trunk bill-only",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-11-trunk-lot-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-11-trunk-decremented.png"
      ],
      "explanation": "A second bill-only order sources the product from Blair's trunk using the OTHER approved lot (LOT-2025-005678). Unlike hospital stock, trunk-sourced orders bill the facility, so this order produces the notification emails that evidence the lot, and the trunk lot decrements at TRUNK-36.",
      "expectedEmailTemplates": [
        "New Bill-Only Order"
      ],
      "startedAt": "2026-08-03T23:06:31.237Z",
      "finishedAt": "2026-08-03T23:06:37.050Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-11-trunk-bill-only.webm"
    },
    {
      "name": "Step 12: DOF notification email",
      "status": "pass",
      "description": "Step 12: DOF notification email",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-12-send-notifications.png",
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-12-notifications-sent.png"
      ],
      "explanation": "The manufacturer sends the Delivered Order Form notification from the bill-only detail page. The DOF email renders the product line with its lot number, proving the lot flows into outbound notifications.",
      "expectedEmailTemplates": [
        "Delivered Order"
      ],
      "startedAt": "2026-08-03T23:06:46.372Z",
      "finishedAt": "2026-08-03T23:06:57.923Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-12-dof-notification.webm"
    },
    {
      "name": "Step 13: Inventory movement history",
      "status": "pass",
      "description": "Step 13: Inventory movement history",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-13-movement-history.png"
      ],
      "explanation": "The movements are recorded as a first-class audit trail: inventory-transaction and inventory-history rows for the product — the ASN receipt (+1) and the two bill-only decrements (−1 each) — each with a quantity, a timestamp, a location, and the user who caused it, rendered here directly from the database rows.",
      "startedAt": "2026-08-03T23:07:02.039Z",
      "finishedAt": "2026-08-03T23:07:02.039Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-13-movement-history.webm"
    },
    {
      "name": "Step 14: Comprehensive lot traceability",
      "status": "pass",
      "description": "Step 14: Comprehensive lot traceability",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-14-traceability.png"
      ],
      "explanation": "A single consolidated view ties the pillars together for the product: the direct order that received the lot, the shipment that carried it, current inventory by lot/location, and every recorded inventory movement — the end-to-end traceability the requirement demands.",
      "startedAt": "2026-08-03T23:07:04.883Z",
      "finishedAt": "2026-08-03T23:07:04.883Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-14-traceability.webm"
    },
    {
      "name": "Step 15: Cross-user visibility",
      "status": "pass",
      "description": "Step 15: Cross-user visibility",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/step-15-admin-visibility.png"
      ],
      "explanation": "An admin user (full visibility) opens the same warehouse inventory and sees the identical lot, quantity, and movement — confirming the traceability data is consistent across users.",
      "startedAt": "2026-08-03T23:07:09.357Z",
      "finishedAt": "2026-08-03T23:07:09.357Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/videos/step-15-admin-visibility.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Product is lot-controlled (policy approved) with a controlled allowed-lot list",
      "query": "SELECT p.sku, p.lot_policy, array_agg(al.lot_value ORDER BY al.lot_value) AS lots\n     FROM org_products p\n     JOIN org_product_allowed_lots al ON al.org_product_id = p.id\n     WHERE p.id = $1 GROUP BY p.id, p.sku, p.lot_policy",
      "status": "pass",
      "rows": [
        {
          "sku": "NEURO-DEVICE-001",
          "lot_policy": "approved",
          "lots": [
            "LOT-2025-001234",
            "LOT-2025-005678"
          ]
        }
      ],
      "assertion": "NEURO-DEVICE-001 has lot_policy 'approved' and allows exactly LOT-2025-001234, LOT-2025-005678"
    },
    {
      "name": "Direct order for the product is approved and produced a fulfillment order",
      "query": "SELECT orq.request_number, orq.order_type, orq.status, fo.order_number\n     FROM order_requests orq\n     JOIN order_request_items ori ON ori.order_request_id = orq.id AND ori.product_id = $1\n     LEFT JOIN fulfillment_orders fo ON fo.order_request_id = orq.id\n     WHERE orq.notes LIKE $2",
      "status": "pass",
      "rows": [
        {
          "request_number": "OR-1",
          "order_type": "direct",
          "status": "approved",
          "order_number": "OR-1-FO-1"
        }
      ],
      "assertion": "A direct-type order request for the product is approved with a fulfillment order"
    },
    {
      "name": "Delivered ASN package carries the SKU + warehouse lot, linked to the fulfillment order",
      "query": "SELECT sp.status, sp.carrier, spi.info->>'sku' AS sku, spi.info->>'lot' AS lot, spi.quantity\n     FROM shipping_packages sp\n     JOIN shipping_package_items spi ON spi.package_id = sp.id\n     JOIN shipping_package_fulfillment_orders spfo ON spfo.shipping_package_id = sp.id\n     JOIN fulfillment_orders fo ON fo.id = spfo.fulfillment_order_id\n     JOIN order_requests orq ON orq.id = fo.order_request_id\n     WHERE orq.notes LIKE $1",
      "status": "pass",
      "rows": [
        {
          "status": "delivered",
          "carrier": "demo",
          "sku": "NEURO-DEVICE-001",
          "lot": "LOT-2025-001234",
          "quantity": 1
        }
      ],
      "assertion": "Package item = NEURO-DEVICE-001/LOT-2025-001234, carrier demo, status delivered"
    },
    {
      "name": "Warehouse lot returned to baseline after +1 (ASN delivery) and −1 (bill-only)",
      "query": "SELECT SUM(quantity_ready)::int AS on_hand\n     FROM inventory_items\n     WHERE real_world_location_id = $1 AND product_id = $2 AND lot = $3",
      "status": "pass",
      "rows": [
        {
          "on_hand": 10
        }
      ],
      "assertion": "Warehouse lot LOT-2025-001234 ends at 10"
    },
    {
      "name": "Trunk lot decremented for the billable trunk-sourced bill-only order",
      "query": "SELECT SUM(quantity_ready)::int AS on_hand\n     FROM inventory_items\n     WHERE real_world_location_id = $1 AND product_id = $2 AND lot = $3",
      "status": "pass",
      "rows": [
        {
          "on_hand": 4
        }
      ],
      "assertion": "Trunk lot LOT-2025-005678 ends at 4"
    },
    {
      "name": "Bill-only orders carry the product line with the warehouse and trunk lots",
      "query": "SELECT boi.lot_number\n     FROM billing_order_items boi\n     WHERE boi.product_id = $1 AND boi.lot_number = ANY($2)\n     ORDER BY boi.lot_number",
      "status": "pass",
      "rows": [
        {
          "lot_number": "LOT-2025-001234"
        },
        {
          "lot_number": "LOT-2025-005678"
        }
      ],
      "assertion": "Bill-only line items exist for lots LOT-2025-001234 and LOT-2025-005678"
    },
    {
      "name": "Both bill-only orders recorded inventory transactions (source_type bill_only_order)",
      "query": "SELECT it.source_type, it.source_id\n     FROM inventory_transactions it\n     WHERE it.source_type = 'bill_only_order' AND it.source_id IN (\n       SELECT DISTINCT boi.billing_order_id FROM billing_order_items boi\n       WHERE boi.product_id = $1)",
      "status": "pass",
      "rows": [
        {
          "source_type": "bill_only_order",
          "source_id": "019fc9e0-7d9b-700e-a987-5842236007ee"
        },
        {
          "source_type": "bill_only_order",
          "source_id": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f"
        }
      ],
      "assertion": "Each bill-only order has a bill_only_order inventory transaction"
    },
    {
      "name": "Inventory-history rows record the movements with user + timestamp",
      "query": "SELECT ih.quantity, ih.status, ih.changed_by, ih.created_at, ii.lot\n     FROM inventory_history ih\n     JOIN inventory_items ii ON ii.id = ih.item_id\n     WHERE ii.product_id = $1\n     ORDER BY ih.created_at ASC",
      "status": "pass",
      "rows": [
        {
          "quantity": 1,
          "status": "ready",
          "changed_by": null,
          "created_at": "2026-08-03T23:05:28.132Z",
          "lot": "LOT-2025-001234"
        },
        {
          "quantity": 1,
          "status": "ready",
          "changed_by": "17b8c9d0-e1f2-3456-1234-567890123456",
          "created_at": "2026-08-03T23:06:00.432Z",
          "lot": "LOT-2025-001234"
        },
        {
          "quantity": 1,
          "status": "ready",
          "changed_by": "17b8c9d0-e1f2-3456-1234-567890123456",
          "created_at": "2026-08-03T23:06:33.296Z",
          "lot": "LOT-2025-005678"
        }
      ],
      "assertion": "At least two movement rows exist (receipt + decrements), each with a timestamp; movements are attributed to users"
    },
    {
      "name": "Direct Order Created email names the product",
      "query": "Email HTML inspection: a /Direct_Order_Created/ capture must contain NEURO-DEVICE-001",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-04-17-378Z-Direct_Order_Created_-_OR-1-FO-1.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: NEURO-DEVICE-001"
    },
    {
      "name": "New Bill-Only email carries the trunk lot",
      "query": "Email HTML inspection: a /New_Bill-Only_Order/ capture must contain NEURO-DEVICE-001, LOT-2025-005678",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-06-01-191Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2.html",
          "matched": false
        },
        {
          "file": "2026-08-03T23-06-34-265Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: NEURO-DEVICE-001, LOT-2025-005678"
    },
    {
      "name": "Delivered Order (DOF) email carries the trunk lot",
      "query": "Email HTML inspection: a /Delivered_Order/ capture must contain NEURO-DEVICE-001, LOT-2025-005678",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-06-48-805Z-Delivered_Order_-_8_3_2026_-_Vantis_BO-3.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: NEURO-DEVICE-001, LOT-2025-005678"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z",
  "auditStartTime": "2026-08-03T23:03:20.604Z",
  "emailEvidence": [
    {
      "subject": "Direct Order Created - OR-1-FO-1",
      "template": "Direct_Order_Created_-_OR-1-FO-1",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/emails/2026-08-03T23-04-17-378Z-Direct_Order_Created_-_OR-1-FO-1.png"
    },
    {
      "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-2",
      "template": "New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/emails/2026-08-03T23-06-01-191Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2.png"
    },
    {
      "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-3",
      "template": "New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/emails/2026-08-03T23-06-34-265Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3.png"
    },
    {
      "subject": "Delivered Order - 8/3/2026 - Vantis BO-3",
      "template": "Delivered_Order_-_8_3_2026_-_Vantis_BO-3",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-032-lot-shipment-inventory-traceability/2026-08-03T23-03-22-458Z/screenshots/emails/2026-08-03T23-06-48-805Z-Delivered_Order_-_8_3_2026_-_Vantis_BO-3.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-08-03T23:03:21.176Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9de-0f5a-79f9-bb52-3da308353ec2",
      "secondaryObjectId": null,
      "payload": {
        "title": "Lot expiration review (1 location need attention)",
        "source": {
          "type": "lot_expiration",
          "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:03:21.285Z",
      "eventType": "decision",
      "action": "ensure_lot_expiration_checklist",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": null,
      "payload": {
        "reason": "created_1_reopened_0_already_open_1",
        "performed": true,
        "entityType": "organization"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:03:25.889Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:03:32.374Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:03:41.781Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:03:46.932Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:04:05.350Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-bc29-7bc7-8afa-9bded8e697bb",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-1",
        "source": {
          "type": "order_request",
          "orderRequestId": "019fc9de-bc12-7d0a-991b-2593c7949fd0"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:05.350Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-bc12-7d0a-991b-2593c7949fd0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-1 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "direct",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-1",
        "selfFulfilled": false,
        "resolvedLocationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
        "resolvedSalesAccountId": "fea7b8c9-d0e1-2345-0123-456789012345",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:07.631Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:04:15.825Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order automatically submitted for fulfillment",
        "toStatus": "submitted",
        "fromStatus": "created",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:15.825Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Fulfillment order created from approved items",
        "toStatus": "created",
        "fromStatus": null,
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:15.825Z",
      "eventType": "decision",
      "action": "extensiv_order_push.skipped",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": "019fc9de-bc12-7d0a-991b-2593c7949fd0",
      "payload": {
        "flags": {
          "wms_integrations": false,
          "extensiv_wms_integration": false
        },
        "reason": "wms_feature_flag_disabled",
        "orderType": "direct",
        "performed": false,
        "entityType": "FulfillmentOrder",
        "triggerReason": "fulfillment_order_submitted"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:15.825Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-bc2d-7695-b80f-d9478374b639",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "approved",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:17.413Z",
      "eventType": "transactional_email",
      "action": "direct_order_created",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9de-eaee-736f-bb28-192407a3eae3/",
        "subject": "Direct Order Created - OR-1-FO-1",
        "messageId": "dev-console-log",
        "relatedEntityType": "fulfillment_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:04:56.498Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:05:08.088Z",
      "eventType": "decision",
      "action": "recalculate_order_status",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-bc12-7d0a-991b-2593c7949fd0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Shipping status updated from null to shipped",
        "performed": true,
        "entityType": "order_request",
        "quantities": {
          "totalShipped": 1,
          "totalApproved": 1,
          "totalDelivered": 0,
          "hasProcessingOrders": false
        },
        "approvalStatus": "approved",
        "toShippingStatus": "shipped",
        "fromShippingStatus": null,
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:05:08.088Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "All items shipped",
        "toStatus": "shipped",
        "fromStatus": "submitted",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:05:13.349Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:05:22.409Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:05:28.132Z",
      "eventType": "decision",
      "action": "enable_team_tracked_inventory_routing",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9df-b0f3-771b-81d5-2be99534c24f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Package linked to direct order",
        "performed": false,
        "entityType": "shipping_package"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:05:28.166Z",
      "eventType": "decision",
      "action": "recalculate_order_status",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-bc12-7d0a-991b-2593c7949fd0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Shipping status updated from shipped to delivered",
        "performed": true,
        "entityType": "order_request",
        "quantities": {
          "totalShipped": 1,
          "totalApproved": 1,
          "totalDelivered": 1,
          "hasProcessingOrders": false
        },
        "approvalStatus": "approved",
        "toShippingStatus": "delivered",
        "fromShippingStatus": "shipped",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:05:28.166Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9de-e52f-7b70-9db0-117fd0f4efa0",
      "secondaryObjectId": null,
      "payload": {
        "reason": "All items delivered",
        "toStatus": "delivered",
        "fromStatus": "shipped",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:05:35.215Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:00.432Z",
      "eventType": "billing_order",
      "action": "status_change",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-7d9b-700e-a987-5842236007ee",
      "secondaryObjectId": null,
      "payload": {
        "reason": null,
        "toStatus": "completed",
        "fromStatus": null,
        "automatedAction": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:00.432Z",
      "eventType": "decision",
      "action": "bill_only.link_purchase_order",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e0-7d9b-700e-a987-5842236007ee",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_purchase_order_selected",
        "performed": false,
        "entityType": "billing_order",
        "salesOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "manufacturerOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:00.432Z",
      "eventType": "decision",
      "action": "bill_only_order.inventory_items_decrement",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-7d9b-700e-a987-5842236007ee",
      "secondaryObjectId": null,
      "payload": {
        "reason": "inventory_items_decremented",
        "itemCount": 1,
        "performed": true,
        "entityType": "billing_order",
        "inventorySource": "inventory_items"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:00.432Z",
      "eventType": "decision",
      "action": "bill_only_order.direct_po_import_on_create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-7d9b-700e-a987-5842236007ee",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No uploaded PO documents",
        "performed": false,
        "entityType": "billing_order",
        "fileSourceOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "hasSelectedPurchaseOrderId": false,
        "purchaseOrderDocumentCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:01.211Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e0-7d9b-700e-a987-5842236007ee",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e0-806e-7f5e-bffb-104d4c615e3a/",
        "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-2",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:04.483Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:11.734Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:33.296Z",
      "eventType": "decision",
      "action": "bill_only_order.inventory_items_decrement",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "inventory_items_decremented",
        "itemCount": 1,
        "performed": true,
        "entityType": "billing_order",
        "inventorySource": "inventory_items"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:33.296Z",
      "eventType": "decision",
      "action": "bill_only_order.direct_po_import_on_create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No uploaded PO documents",
        "performed": false,
        "entityType": "billing_order",
        "fileSourceOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "hasSelectedPurchaseOrderId": false,
        "purchaseOrderDocumentCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:33.296Z",
      "eventType": "billing_order",
      "action": "status_change",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "reason": null,
        "toStatus": "submitted",
        "fromStatus": null,
        "automatedAction": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:33.296Z",
      "eventType": "decision",
      "action": "bill_only.link_purchase_order",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_purchase_order_selected",
        "performed": false,
        "entityType": "billing_order",
        "salesOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "manufacturerOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:34.280Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e1-019e-74ce-8221-b3bd354edb6c/",
        "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-3",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:39.950Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:48.825Z",
      "eventType": "transactional_email",
      "action": "bill_only_dof_generated",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e0-fdf3-7125-9dbb-00e622c7a90f",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e1-3a6e-791d-87d8-4fc37dd8c4bc/",
        "subject": "Delivered Order - 8/3/2026 - Vantis BO-3",
        "messageId": "dev-console-log",
        "attachmentFiles": [
          {
            "s3Key": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e1-3a6e-791d-87d8-4fc37dd8c4bc/attachments/1-BO-3-delivered-order-form-2026-08-03.pdf",
            "filename": "BO-3-delivered-order-form-2026-08-03.pdf"
          }
        ],
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:06.501Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    }
  ],
  "auditQuery": "SELECT\n    ae.created_at,\n    ae.event_type,\n    ae.action,\n    ae.user_id,\n    u.email AS user_email,\n    ae.organization_id,\n    o.name AS organization_name,\n    ae.object_id,\n    ae.secondary_object_id,\n    ae.payload,\n    ae.route,\n    ae.trace_id\n  FROM audit_events ae\n  LEFT JOIN users u ON u.id = ae.user_id\n  LEFT JOIN organizations o ON o.id = ae.organization_id\n  WHERE ae.created_at >= $1\n    AND ae.organization_id = ANY($2::uuid[])\n  ORDER BY ae.created_at ASC",
  "auditAssertions": [],
  "emailAssertions": [
    {
      "stepName": "Step 5: Approve order",
      "expectedTemplate": "Direct Order Created",
      "found": true
    },
    {
      "stepName": "Step 11: Trunk bill-only",
      "expectedTemplate": "New Bill-Only Order",
      "found": true
    },
    {
      "stepName": "Step 12: DOF notification email",
      "expectedTemplate": "Delivered Order",
      "found": true
    }
  ]
}