{
  "validated_at": "2026-05-05",
  "scope": "local real-data databases matching farmacia_*",
  "artisan_health_check": {
    "command": "php artisan lots:health-check --tenant=farmacia_demo",
    "status": "failed",
    "output": "No se encontraron tenants.",
    "reason": "farmacia_* databases are not registered in enterfarmaplus.websites in this local system database."
  },
  "registered_local_websites": [
    "tenancy_demo",
    "tenancy_jena"
  ],
  "real_data_databases": [
    {
      "tenant": "farmacia_angelito",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 1,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_boticabienestar",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 1,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_boticadiaz",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 2,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_boticapedrito",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 157,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_demo",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 0,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_miangelito",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 0,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_miangelito1",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 0,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_mqn",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 0,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_noriega",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 368,
      "legacy_negative_lots": 5,
      "duplicate_code_item_pairs": 0,
      "negative_lot_samples": [
        {"id": 131, "code": "24505001", "item_id": 150, "quantity": -16},
        {"id": 279, "code": "2012445", "item_id": 444, "quantity": -7},
        {"id": 339, "code": "2120874", "item_id": 504, "quantity": -6},
        {"id": 282, "code": "50264", "item_id": 447, "quantity": -4},
        {"id": 346, "code": "10115985", "item_id": 511, "quantity": -2}
      ]
    },
    {
      "tenant": "farmacia_pedrito",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 34,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_sanfrancisco",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 1,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    },
    {
      "tenant": "farmacia_shaddai",
      "has_item_lots_group_warehouse": false,
      "pivot_migration_rows": 0,
      "legacy_lots_total": 403,
      "legacy_negative_lots": 0,
      "duplicate_code_item_pairs": 0
    }
  ],
  "flow_validation": {
    "executed": false,
    "reason": "Per-warehouse lot pivot table is missing in all farmacia_* tenants and controlled writes were not executed against real-data tenants."
  },
  "conclusion": "Not validated as OK. Real-data tenants are blocked until lot-pivot migration/backfill is applied and farmacia_noriega negative legacy lots are resolved."
}
