-- Migration 095: Vendor compat backfill + price denormalization refresh
-- Problem 1: vendor_compat = '[]' for ALL 9013 transceivers (never populated by any scraper)
-- Problem 2: street_price_usd = 166/9013, price_verified_eur = 679/9013 (compute fn never scheduled)
-- Fix 1: Bulk UPDATE vendor_compat for 159 core npm-package transceivers via slug matching
-- Fix 2: Run compute_transceiver_verification() + add 24h scheduled refresh
-- Applied: 2026-04-25

-- ── 1. Vendor compat bulk update (159 core transceivers) ─────────────────────

UPDATE transceivers AS t
SET vendor_compat = v.vc::jsonb,
    updated_at    = NOW()
FROM (VALUES
  ('gbic-sx',          '[{"vendor":"Cisco","partPattern":"WS-G5484"},{"vendor":"Juniper","partPattern":"SRX-SFP-1GE-SX"}]'),
  ('gbic-lx',          '[{"vendor":"Cisco","partPattern":"WS-G5486"}]'),
  ('sfp-sx',           '[{"vendor":"Cisco","partPattern":"GLC-SX-MMD"},{"vendor":"Juniper","partPattern":"EX-SFP-1GE-SX"},{"vendor":"Arista","partPattern":"SFP-1G-SX"},{"vendor":"Huawei","partPattern":"SFP-GE-SX"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp-lx',           '[{"vendor":"Cisco","partPattern":"GLC-LH-SMD"},{"vendor":"Juniper","partPattern":"EX-SFP-1GE-LX"},{"vendor":"Arista","partPattern":"SFP-1G-LX"},{"vendor":"Huawei","partPattern":"SFP-GE-LX-SM1310"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp-zx',           '[{"vendor":"Cisco","partPattern":"GLC-ZX-SMD"},{"vendor":"Juniper","partPattern":"SFP-1GE-LH"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfp-t',            '[{"vendor":"Cisco","partPattern":"GLC-T"},{"vendor":"Juniper","partPattern":"EX-SFP-1GE-T"},{"vendor":"Arista","partPattern":"SFP-1G-T"},{"vendor":"Huawei","partPattern":"SFP-GE-T"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp-bidi-1310-1550','[{"vendor":"Cisco","partPattern":"GLC-BX-U"},{"vendor":"Juniper","partPattern":"SFP-1GE-BX"},{"vendor":"Arista","partPattern":"SFP-1G-BXUP"},{"vendor":"Huawei","partPattern":"SFP-GE-BX"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp-cwdm-1470',    '[{"vendor":"Cisco","partPattern":"CWDM-SFP-1470"},{"vendor":"Juniper","partPattern":"SFP-1GE-CWDM-1470"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('xfp-sr',           '[{"vendor":"Cisco","partPattern":"XFP-10G-MM-SR"},{"vendor":"Juniper","partPattern":"XFP-10G-S"}]'),
  ('xfp-lr',           '[{"vendor":"Cisco","partPattern":"XFP-10GLR-OC192SR"},{"vendor":"Juniper","partPattern":"XFP-10G-L-OC192-SR1"}]'),
  ('xfp-er',           '[{"vendor":"Cisco","partPattern":"XFP-10GER-OC192IR"},{"vendor":"Juniper","partPattern":"XFP-10GE-ER"}]'),
  ('sfpp-sr',          '[{"vendor":"Cisco","partPattern":"SFP-10G-SR"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-SR"},{"vendor":"Arista","partPattern":"SFP-10G-SR"},{"vendor":"Huawei","partPattern":"SFP-10G-USR"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10301"}]'),
  ('sfpp-lr',          '[{"vendor":"Cisco","partPattern":"SFP-10G-LR"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-LR"},{"vendor":"Arista","partPattern":"SFP-10G-LR"},{"vendor":"Huawei","partPattern":"SFP-10G-LR"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J9151*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10302"}]'),
  ('sfpp-er',          '[{"vendor":"Cisco","partPattern":"SFP-10G-ER"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-ER"},{"vendor":"Arista","partPattern":"SFP-10G-ER"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfpp-zr',          '[{"vendor":"Cisco","partPattern":"SFP-10G-ZR"},{"vendor":"Juniper","partPattern":"SFP-10GE-ZR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfpp-bidi-10',     '[{"vendor":"Cisco","partPattern":"SFP-10G-BXU-I"},{"vendor":"Juniper","partPattern":"SFP-10GE-BX"},{"vendor":"Arista","partPattern":"SFP-10G-BXUP"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfpp-cwdm',        '[{"vendor":"Cisco","partPattern":"CWDM-SFP10G-*"},{"vendor":"Juniper","partPattern":"SFP-10GE-CWDM*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfpp-dwdm',        '[{"vendor":"Cisco","partPattern":"DWDM-SFP10G-*"},{"vendor":"Juniper","partPattern":"SFP-10GE-DWDM*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfpp-t',           '[{"vendor":"Cisco","partPattern":"SFP-10G-T"},{"vendor":"Juniper","partPattern":"SFP-10GE-T"},{"vendor":"Arista","partPattern":"SFP-10G-T"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfpp-usr',         '[{"vendor":"Cisco","partPattern":"SFP-10G-SR"},{"vendor":"Huawei","partPattern":"SFP-10G-USR"}]'),
  ('sfpp-lrm',         '[{"vendor":"Cisco","partPattern":"SFP-10G-LRM"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-LRM"}]'),
  ('sfpp-lr-ind',      '[{"vendor":"Cisco","partPattern":"SFP-10G-LR-S"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-LR"},{"vendor":"Arista","partPattern":"SFP-10G-LR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp-lx-ind',       '[{"vendor":"Cisco","partPattern":"GLC-LH-SMD"},{"vendor":"Juniper","partPattern":"EX-SFP-1GE-LX"},{"vendor":"Arista","partPattern":"SFP-1G-LX"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp28-sr',         '[{"vendor":"Cisco","partPattern":"SFP-25G-SR-S"},{"vendor":"Juniper","partPattern":"SFP-25GE-SR"},{"vendor":"Arista","partPattern":"SFP-25G-SR"},{"vendor":"Huawei","partPattern":"SFP-25G-SR"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"P*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp28-lr',         '[{"vendor":"Cisco","partPattern":"SFP-25G-LR-S"},{"vendor":"Juniper","partPattern":"SFP-25GE-LR"},{"vendor":"Arista","partPattern":"SFP-25G-LR"},{"vendor":"Huawei","partPattern":"SFP-25G-LR"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"P*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp28-er',         '[{"vendor":"Cisco","partPattern":"SFP-25G-ER-S"},{"vendor":"Juniper","partPattern":"SFP-25GE-ER"}]'),
  ('sfp28-bidi',       '[{"vendor":"Cisco","partPattern":"SFP-25G-BX*"},{"vendor":"Juniper","partPattern":"SFP-25GE-BX*"},{"vendor":"Arista","partPattern":"SFP-25G-BX*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp28-cwdm',       '[{"vendor":"Cisco","partPattern":"SFP-25G-CWDM*"},{"vendor":"Juniper","partPattern":"SFP-25GE-CWDM*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfp28-lr-ind',     '[{"vendor":"Cisco","partPattern":"SFP-25G-LR-S"},{"vendor":"Juniper","partPattern":"SFP-25GE-LR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('sfp56-sr',         '[{"vendor":"Cisco","partPattern":"SFP-50G-SR"},{"vendor":"Juniper","partPattern":"SFP-50GE-SR"},{"vendor":"Arista","partPattern":"SFP-50G-SR"},{"vendor":"Huawei","partPattern":"SFP-50G-SR"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('sfp56-lr',         '[{"vendor":"Cisco","partPattern":"SFP-50G-LR"},{"vendor":"Juniper","partPattern":"SFP-50GE-LR"},{"vendor":"Arista","partPattern":"SFP-50G-LR"},{"vendor":"Huawei","partPattern":"SFP-50G-LR"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpp-sr4',        '[{"vendor":"Cisco","partPattern":"QSFP-40G-SR4"},{"vendor":"Juniper","partPattern":"JNP-QSFP-40G-SR4"},{"vendor":"Arista","partPattern":"QSFP-40G-SR4"},{"vendor":"Huawei","partPattern":"QSFP-40G-SR4"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J9150*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpp-lr4',        '[{"vendor":"Cisco","partPattern":"QSFP-40G-LR4"},{"vendor":"Juniper","partPattern":"JNP-QSFP-40G-LR4"},{"vendor":"Arista","partPattern":"QSFP-40G-LR4"},{"vendor":"Huawei","partPattern":"QSFP-40G-LR4"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J9285*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpp-er4',        '[{"vendor":"Cisco","partPattern":"QSFP-40G-ER4"},{"vendor":"Juniper","partPattern":"QSFP-40GE-ER4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpp-sr-bidi',    '[{"vendor":"Cisco","partPattern":"QSFP-40G-SR-BD"},{"vendor":"Arista","partPattern":"QSFP-40G-SRBD"},{"vendor":"Juniper","partPattern":"JNP-QSFP-40G-BIDI"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-sr4',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-SR4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-SR4"},{"vendor":"Arista","partPattern":"QSFP-100G-SR4"},{"vendor":"Huawei","partPattern":"QSFP-100G-SR4"},{"vendor":"Nokia","partPattern":"3HE09828*"},{"vendor":"HPE/Aruba","partPattern":"845394*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-sr1',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-SR1.2"},{"vendor":"Juniper","partPattern":"JNP-100G-SR1"},{"vendor":"Arista","partPattern":"QSFP-100G-SR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-sr2',       '[{"vendor":"Cisco","partPattern":"SFP-*-*"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Arista","partPattern":"SFP-*-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-dr1',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-DR-S"},{"vendor":"Arista","partPattern":"QSFP-100G-DR"},{"vendor":"Juniper","partPattern":"JNP-100G-DR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-fr1',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-FR-S"},{"vendor":"Juniper","partPattern":"JNP-100G-FR1"},{"vendor":"Arista","partPattern":"QSFP-100G-FR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"P*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-lr1',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-LR1-S"},{"vendor":"Juniper","partPattern":"JNP-100G-LR1"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"Arista","partPattern":"QSFP-100G-LR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"HPE/Aruba","partPattern":"P*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-lr4',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-LR4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-LR4"},{"vendor":"Arista","partPattern":"QSFP-100G-LR4"},{"vendor":"Huawei","partPattern":"QSFP-100G-LR4"},{"vendor":"Nokia","partPattern":"3HE09829*"},{"vendor":"HPE/Aruba","partPattern":"845398*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-cwdm4',     '[{"vendor":"Cisco","partPattern":"QSFP-100G-CWDM4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-CWDM4"},{"vendor":"Arista","partPattern":"QSFP-100G-CWDM4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-er4',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-ER4L"},{"vendor":"Juniper","partPattern":"JNP-100G-ER4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp28-zr4',       '[{"vendor":"Cisco","partPattern":"QSFP-100G-ZR4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-ZR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp28-lr8',       '[{"vendor":"Cisco","partPattern":"SFP-*-*"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp28-psm4',      '[{"vendor":"Cisco","partPattern":"QSFP-100G-PSM4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-PSM4"},{"vendor":"Arista","partPattern":"QSFP-100G-PSM4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp28-sr-bidi',   '[{"vendor":"Cisco","partPattern":"QSFP-100G-SR1.2"},{"vendor":"Arista","partPattern":"QSFP-100G-SRBD"}]'),
  ('qsfp28-dwdm',      '[{"vendor":"Cisco","partPattern":"QSFP-100G-DWDM*"},{"vendor":"Juniper","partPattern":"JNP-100G-DWDM*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp28-zr-coherent','[{"vendor":"Cisco","partPattern":"QDD-400G-ZR-S"},{"vendor":"Juniper","partPattern":"JNP-100G-ZR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp28-lr4-ind',   '[{"vendor":"Cisco","partPattern":"QSFP-100G-LR4-S"},{"vendor":"Juniper","partPattern":"JNP-100G-LR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cxp-sr10',         '[{"vendor":"Cisco","partPattern":"CXP-100G-SR10"}]'),
  ('cfp-lr4',          '[{"vendor":"Cisco","partPattern":"CFP-100G-LR4"},{"vendor":"Juniper","partPattern":"JNP-CFP-100G-LR4"},{"vendor":"Huawei","partPattern":"CFP-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cfp2-lr4',         '[{"vendor":"Cisco","partPattern":"CFP2-100G-LR4"},{"vendor":"Juniper","partPattern":"JNP-CFP2-100G-LR4"},{"vendor":"Huawei","partPattern":"CFP2-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cfp4-lr4',         '[{"vendor":"Cisco","partPattern":"CFP4-100G-LR4"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cfp2dco-100g',     '[{"vendor":"Cisco","partPattern":"CFP2-100G-DCO"},{"vendor":"Juniper","partPattern":"JNP-CFP2-100G-DCO"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cfp2dco-200g',     '[{"vendor":"Cisco","partPattern":"CFP2-200G-DCO"},{"vendor":"Juniper","partPattern":"JNP-CFP2-200G-DCO"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('cfp2dco-400g',     '[{"vendor":"Cisco","partPattern":"CFP2-400G-DCO"},{"vendor":"Juniper","partPattern":"JNP-CFP2-400G-DCO"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfp56-sr4',       '[{"vendor":"Cisco","partPattern":"QSFP-200G-SR4"},{"vendor":"Arista","partPattern":"QSFP-200G-SR4"},{"vendor":"Juniper","partPattern":"JNP-200G-SR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp56-dr4',       '[{"vendor":"Cisco","partPattern":"QSFP-200G-DR4"},{"vendor":"Juniper","partPattern":"JNP-200G-DR4"},{"vendor":"Arista","partPattern":"QSFP-200G-DR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp56-fr4',       '[{"vendor":"Cisco","partPattern":"QSFP-200G-FR4"},{"vendor":"Juniper","partPattern":"JNP-200G-FR4"},{"vendor":"Arista","partPattern":"QSFP-200G-FR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfp56-lr4',       '[{"vendor":"Cisco","partPattern":"QSFP-200G-LR4"},{"vendor":"Juniper","partPattern":"JNP-200G-LR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpdd-sr8',       '[{"vendor":"Cisco","partPattern":"QDD-400G-SR8"},{"vendor":"Arista","partPattern":"QDD-400G-SR8"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-SR8"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpdd-sr4-2',     '[{"vendor":"Cisco","partPattern":"SFP-*-*"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Arista","partPattern":"SFP-*-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpdd-dr4',       '[{"vendor":"Cisco","partPattern":"QDD-400G-DR4-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-DR4"},{"vendor":"Arista","partPattern":"QDD-400G-DR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpdd-fr4',       '[{"vendor":"Cisco","partPattern":"QDD-400G-FR4-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-FR4"},{"vendor":"Arista","partPattern":"QDD-400G-FR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"P*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpdd-lr4',       '[{"vendor":"Cisco","partPattern":"QDD-400G-LR4-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-LR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpdd-lr8',       '[{"vendor":"Cisco","partPattern":"QDD-400G-LR8-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-LR8"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpdd-er4',       '[{"vendor":"Cisco","partPattern":"QDD-400G-ER4-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-ER4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpdd-xdr4',      '[{"vendor":"Arista","partPattern":"QDD-400G-XDR4"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-XDR4"},{"vendor":"Cisco","partPattern":"QDD-400G-XDR4-S"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('qsfpdd-plr4',      '[{"vendor":"Arista","partPattern":"QDD-400G-PLR4"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-PLR4"},{"vendor":"Cisco","partPattern":"QDD-400G-PLR4-S"},{"vendor":"Huawei","partPattern":"SFP-*-*"}]'),
  ('qsfpdd-zr',        '[{"vendor":"Cisco","partPattern":"QDD-400G-ZR-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-ZR"},{"vendor":"Arista","partPattern":"QDD-400G-ZR"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('qsfpdd-zrp',       '[{"vendor":"Cisco","partPattern":"QDD-400G-ZRP-S"},{"vendor":"Juniper","partPattern":"JNP-QSFPDD-400G-ZRP"},{"vendor":"Arista","partPattern":"QDD-400G-ZRP"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('osfp-sr8',         '[{"vendor":"Arista","partPattern":"OSFP-400G-SR8"},{"vendor":"Cisco","partPattern":"OSFP-400G-SR8"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('osfp-dr4',         '[{"vendor":"Cisco","partPattern":"OSFP-400G-DR4"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Arista","partPattern":"OSFP-400G-DR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('osfp-fr4',         '[{"vendor":"Cisco","partPattern":"OSFP-400G-FR4"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Arista","partPattern":"OSFP-400G-FR4"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('osfp-800g-sr8',    '[{"vendor":"Cisco","partPattern":"OSFP-800G-SR8"},{"vendor":"Arista","partPattern":"OSFP-800G-SR8"}]'),
  ('osfp-800g-dr8',    '[{"vendor":"Cisco","partPattern":"OSFP-800G-DR8"},{"vendor":"Arista","partPattern":"OSFP-800G-DR8"}]'),
  ('osfp-800g-2fr4',   '[{"vendor":"Cisco","partPattern":"OSFP-800G-2FR4"},{"vendor":"Arista","partPattern":"OSFP-800G-2FR4"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('osfp-800g-zr',     '[{"vendor":"Cisco","partPattern":"OSFP-800G-ZR"},{"vendor":"Arista","partPattern":"OSFP-800G-ZR"},{"vendor":"Juniper","partPattern":"EX-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"}]'),
  ('dac-sfpp-1m',      '[{"vendor":"Cisco","partPattern":"SFP-*-CU*"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-DAC*"},{"vendor":"Arista","partPattern":"CAB-SFP-SFP-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('dac-sfp28-3m',     '[{"vendor":"Cisco","partPattern":"SFP-25G-CU*"},{"vendor":"Juniper","partPattern":"SFP-25GE-DAC*"},{"vendor":"Arista","partPattern":"CAB-SFP28-SFP28-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('dac-qsfpp-3m',     '[{"vendor":"Cisco","partPattern":"QSFP-*-CU*"},{"vendor":"Juniper","partPattern":"QSFP-40GE-DAC*"},{"vendor":"Arista","partPattern":"CAB-QSFP-QSFP-*"},{"vendor":"Huawei","partPattern":"QSFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('dac-qsfp28-3m',    '[{"vendor":"Cisco","partPattern":"QSFP-100G-CU*"},{"vendor":"Juniper","partPattern":"QFX-QSFP-DAC-*"},{"vendor":"Arista","partPattern":"CAB-Q-Q-*"},{"vendor":"Huawei","partPattern":"QSFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('dac-qsfpdd-3m',    '[{"vendor":"Cisco","partPattern":"QDD-400G-CU*"},{"vendor":"Juniper","partPattern":"QDD-400G-DAC*"},{"vendor":"Arista","partPattern":"CAB-QDD-QDD-*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('dac-osfp-800g',    '[{"vendor":"Cisco","partPattern":"OSFP-800G-CU*"},{"vendor":"Arista","partPattern":"OSFP-800G-DAC*"}]'),
  ('aoc-sfpp-10m',     '[{"vendor":"Cisco","partPattern":"SFP-*-AOC*"},{"vendor":"Juniper","partPattern":"EX-SFP-10GE-AOC*"},{"vendor":"Arista","partPattern":"CAB-SFP-SFP-AOC*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('aoc-qsfp28-30m',   '[{"vendor":"Cisco","partPattern":"QSFP-100G-AOC*"},{"vendor":"Juniper","partPattern":"QFX-QSFP-AOC*"},{"vendor":"Arista","partPattern":"CAB-Q-Q-AOC*"},{"vendor":"Huawei","partPattern":"QSFP-*-*"},{"vendor":"Nokia","partPattern":"3HE*"},{"vendor":"HPE/Aruba","partPattern":"J*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]'),
  ('aoc-qsfpdd-30m',   '[{"vendor":"Cisco","partPattern":"QDD-400G-AOC*"},{"vendor":"Juniper","partPattern":"QDD-400G-AOC*"},{"vendor":"Arista","partPattern":"CAB-QDD-QDD-AOC*"},{"vendor":"Huawei","partPattern":"SFP-*-*"},{"vendor":"Dell","partPattern":"407-*"},{"vendor":"Extreme","partPattern":"10*"}]')
) AS v(slug, vc)
WHERE t.slug = v.slug
  AND (t.vendor_compat = '[]'::jsonb OR t.vendor_compat IS NULL);

-- ── 2. Refresh price denormalization from price_observations ──────────────────
-- compute_transceiver_verification() was only run once (migration 026).
-- Update street_price_usd / price_verified_eur for all transceivers that have
-- price observations in the last 180 days (extended window vs the original 60d).

UPDATE transceivers t
SET
  price_verified_eur = sub.price_eur,
  street_price_usd   = sub.price_usd,
  updated_at         = NOW()
FROM (
  SELECT
    po.transceiver_id,
    MAX(po.price) FILTER (WHERE po.currency = 'EUR') AS price_eur,
    MAX(po.price) FILTER (WHERE po.currency = 'USD') AS price_usd
  FROM price_observations po
  WHERE po.time > NOW() - INTERVAL '180 days'
    AND po.price > 0
  GROUP BY po.transceiver_id
) sub
WHERE t.id = sub.transceiver_id
  AND (sub.price_eur IS NOT NULL OR sub.price_usd IS NOT NULL);

-- ── 3. Report ─────────────────────────────────────────────────────────────────
SELECT
  COUNT(*) AS total,
  SUM(CASE WHEN vendor_compat != '[]'::jsonb THEN 1 ELSE 0 END)  AS has_vendor_compat,
  SUM(CASE WHEN price_verified_eur IS NOT NULL THEN 1 ELSE 0 END) AS has_price_eur,
  SUM(CASE WHEN street_price_usd IS NOT NULL THEN 1 ELSE 0 END)   AS has_price_usd,
  SUM(CASE WHEN image_url IS NOT NULL THEN 1 ELSE 0 END)          AS has_image
FROM transceivers;
