-- Migration 055 — MikroTik CRS/CCR product images + NVIDIA ConnectX-7 400G
--
-- MikroTik: official CDN at cdn.mikrotik.com/web-assets/rb_images/{id}_tm.webp
--   IDs extracted from mikrotik.com/products/group/switches + individual product pages.
--   CRS354-48G-4S+2Q+ was the only model with image_url IS NULL (scraper failed on
--   the "+" chars in the URL slug; all others were populated by the Playwright scraper).
--   All 8 URLs verified HTTP 200 webp image (2026-04-21).
--
-- NVIDIA ConnectX-7 400G: FS.com reseller CDN (js-rendered official site unreachable).

-- ── MikroTik ───────────────────────────────────────────────────────────────────

-- CRS504-4XQ-IN — 4×100G QSFP28 spine switch
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/2156_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs504_4xq_in'),
    assets_scraped_at = NOW()
WHERE model = 'CRS504-4XQ-IN'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS518-16XS-2XQ — 16×25G SFP28 + 2×100G QSFP28
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/2196_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs518_16xs_2xq_rm'),
    assets_scraped_at = NOW()
WHERE model = 'CRS518-16XS-2XQ'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS354-48G-4S+2Q+ — 48G + 4×SFP+ + 2×QSFP+ (scraper slug had "+" issues)
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/1899_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs354_48g_4splus2qplusrm'),
    assets_scraped_at = NOW()
WHERE model = 'CRS354-48G-4S+2Q+'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS326-24G-2S+ — 24G + 2×SFP+ desktop/rackmount switch
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/1938_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs326_24g_2splus_in'),
    assets_scraped_at = NOW()
WHERE model = 'CRS326-24G-2S+'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS317-1G-16S+ — 16×SFP+ 1U rackmount switch
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/1324_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs317_1g_16s_plus_rm'),
    assets_scraped_at = NOW()
WHERE model = 'CRS317-1G-16S+'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS312-4C+8XG — 4×combo + 8×10G 1U rackmount switch
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/1825_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs312_4c_plus8xg_rm'),
    assets_scraped_at = NOW()
WHERE model = 'CRS312-4C+8XG'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CRS305-1G-4S+ — 4×SFP+ desktop switch
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/1659_tm.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/crs305_1g_4splus_in'),
    assets_scraped_at = NOW()
WHERE model = 'CRS305-1G-4S+'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- CCR2216-1G-12XS-2XQ — Cloud Core Router, 12×25G + 2×100G
UPDATE switches
SET image_url        = 'https://cdn.mikrotik.com/web-assets/rb_images/2122_lg.webp',
    product_page_url = COALESCE(product_page_url, 'https://mikrotik.com/product/ccr2216_1g_12xs_2xq'),
    assets_scraped_at = NOW()
WHERE model = 'CCR2216-1G-12XS-2XQ'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'mikrotik')
  AND image_url IS NULL;

-- ── NVIDIA Networking ──────────────────────────────────────────────────────────

-- ConnectX-7 400G — PCIe Gen5 dual-port 400GbE/NDR NIC (NVIDIA site JS-rendered)
UPDATE switches
SET image_url        = 'https://resource.fs.com/mall/mainImg/20250830110725tdcyqd.jpg.webp',
    product_page_url = COALESCE(product_page_url, 'https://www.nvidia.com/en-us/networking/ethernet-adapters/'),
    assets_scraped_at = NOW()
WHERE model = 'ConnectX-7 400G'
  AND vendor_id = (SELECT id FROM vendors WHERE slug = 'nvidia-networking')
  AND image_url IS NULL;
