/**
 * Bulk Switch & Router Seed Data — Remaining Flexoptix-Supported Vendors
 *
 * Covers ALL vendors from flexoptix-supported-vendors.ts that don't yet have
 * switch/router product entries in switch-seed.ts or switch-seed-extended.ts.
 *
 * This file adds representative models per vendor — actual model catalogs
 * will be enriched by the Crawlee scrapers hitting vendor product pages.
 *
 * Vendors already covered in other seed files (NOT included here):
 *   switch-seed.ts: Arista, Cisco, Dell, Extreme, HPE Aruba, Huawei,
 *                   Juniper, Nokia, NVIDIA/Mellanox, Celestica, Edgecore, UfiSpace
 *   switch-seed-extended.ts: Fortinet, MikroTik, Ubiquiti, Netgear, Allied Telesis,
 *                            TP-Link, Zyxel, Moxa, Hirschmann, Siemens, Phoenix Contact,
 *                            Westermo, Check Point, F5, Palo Alto
 */
import { pool, ensureVendor, findOrCreateSwitch } from "../utils/db";

interface SwitchSeed {
  vendor: string;
  vendorType: string;
  vendorWebsite: string;
  model: string;
  series: string;
  category: "DataCenter" | "Campus" | "Edge" | "Core" | "SP" | "Industrial";
  layer: "L2" | "L3" | "L2/L3";
  portsConfig: Record<string, number>;
  totalPorts: number;
  uplinkSpeedGbps?: number;
  maxSpeedGbps: number;
  switchingCapacityTbps?: number;
  forwardingRateMpps?: number;
  asicVendor?: string;
  asicModel?: string;
  rackUnits?: number;
  maxPowerW?: number;
  poeSupport?: string;
  stackingSupport?: boolean;
  vxlanSupport?: boolean;
  evpnSupport?: boolean;
  bgpSupport?: boolean;
  mplsSupport?: boolean;
  openconfigSupport?: boolean;
  sonicCompatible?: boolean;
  macsecSupport?: boolean;
  lifecycleStatus?: string;
  tags?: string[];
}

// ═══════════════════════════════════════════════════════
// D-LINK
// ═══════════════════════════════════════════════════════
const DLINK: SwitchSeed[] = [
  {
    vendor: "D-Link", vendorType: "oem", vendorWebsite: "https://www.dlink.com",
    model: "DGS-3130-30TS", series: "DGS-3130", category: "Campus", layer: "L3",
    portsConfig: { "1G_RJ45": 24, "10G_SFP+": 6 }, totalPorts: 30,
    maxSpeedGbps: 10, switchingCapacityTbps: 0.172, stackingSupport: true,
    tags: ["campus", "stackable", "L3-lite"],
  },
  {
    vendor: "D-Link", vendorType: "oem", vendorWebsite: "https://www.dlink.com",
    model: "DXS-3610-54T", series: "DXS-3610", category: "DataCenter", layer: "L3",
    portsConfig: { "10G_RJ45": 48, "100G_QSFP28": 6 }, totalPorts: 54,
    maxSpeedGbps: 100, switchingCapacityTbps: 1.76, bgpSupport: true,
    tags: ["10G", "datacenter", "ToR"],
  },
  {
    vendor: "D-Link", vendorType: "oem", vendorWebsite: "https://www.dlink.com",
    model: "DMS-3130-30TS", series: "DMS-3130", category: "Campus", layer: "L2/L3",
    portsConfig: { "2.5G_RJ45": 24, "10G_SFP+": 6 }, totalPorts: 30,
    maxSpeedGbps: 10, poeSupport: "PoE++",
    tags: ["multigigabit", "PoE", "campus"],
  },
];

// ═══════════════════════════════════════════════════════
// ALCATEL-LUCENT ENTERPRISE
// ═══════════════════════════════════════════════════════
const ALE: SwitchSeed[] = [
  {
    vendor: "Alcatel-Lucent Enterprise", vendorType: "oem", vendorWebsite: "https://www.al-enterprise.com",
    model: "OmniSwitch 6900-X72", series: "OS6900", category: "DataCenter", layer: "L3",
    portsConfig: { "10G_SFP+": 48, "40G_QSFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 40, switchingCapacityTbps: 1.44, bgpSupport: true, evpnSupport: true,
    tags: ["datacenter", "SPB", "fabric"],
  },
  {
    vendor: "Alcatel-Lucent Enterprise", vendorType: "oem", vendorWebsite: "https://www.al-enterprise.com",
    model: "OmniSwitch 6560-P48Z8", series: "OS6560", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE++", stackingSupport: true,
    tags: ["campus", "PoE", "stackable"],
  },
  {
    vendor: "Alcatel-Lucent Enterprise", vendorType: "oem", vendorWebsite: "https://www.al-enterprise.com",
    model: "OmniSwitch 9900-C32D", series: "OS9900", category: "Core", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 25.6, bgpSupport: true, evpnSupport: true,
    tags: ["400G", "spine", "datacenter"],
  },
];

// ═══════════════════════════════════════════════════════
// BROCADE (now Broadcom/Ruckus)
// ═══════════════════════════════════════════════════════
const BROCADE: SwitchSeed[] = [
  {
    vendor: "Brocade", vendorType: "oem", vendorWebsite: "https://www.broadcom.com",
    model: "ICX 7850-48FS", series: "ICX 7850", category: "DataCenter", layer: "L3",
    portsConfig: { "10G_SFP+": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 1.76, stackingSupport: true,
    bgpSupport: true, vxlanSupport: true,
    tags: ["campus-core", "10G", "stackable"],
  },
  {
    vendor: "Brocade", vendorType: "oem", vendorWebsite: "https://www.broadcom.com",
    model: "G720", series: "G720", category: "DataCenter", layer: "L2",
    portsConfig: { "64G_FC": 48 }, totalPorts: 48,
    maxSpeedGbps: 64,
    tags: ["FC", "SAN", "storage"],
  },
  {
    vendor: "Brocade", vendorType: "oem", vendorWebsite: "https://www.broadcom.com",
    model: "G730", series: "G730", category: "DataCenter", layer: "L2",
    portsConfig: { "64G_FC": 64 }, totalPorts: 64,
    maxSpeedGbps: 64,
    tags: ["FC", "SAN", "Gen7", "storage"],
  },
];

// ═══════════════════════════════════════════════════════
// H3C (HPE China / New H3C)
// ═══════════════════════════════════════════════════════
const H3C: SwitchSeed[] = [
  {
    vendor: "H3C", vendorType: "oem", vendorWebsite: "https://www.h3c.com",
    model: "S12500X-AF", series: "S12500", category: "Core", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 72 }, totalPorts: 72,
    maxSpeedGbps: 400, switchingCapacityTbps: 57.6, bgpSupport: true,
    tags: ["chassis", "core", "400G"],
  },
  {
    vendor: "H3C", vendorType: "oem", vendorWebsite: "https://www.h3c.com",
    model: "S6860-54HT", series: "S6860", category: "DataCenter", layer: "L3",
    portsConfig: { "10G_RJ45": 48, "100G_QSFP28": 6 }, totalPorts: 54,
    maxSpeedGbps: 100, switchingCapacityTbps: 1.76, bgpSupport: true,
    tags: ["datacenter", "ToR", "10G-BaseT"],
  },
  {
    vendor: "H3C", vendorType: "oem", vendorWebsite: "https://www.h3c.com",
    model: "S5170-54S-EI", series: "S5170", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 10, poeSupport: "PoE+", stackingSupport: true,
    tags: ["campus", "stackable"],
  },
];

// ═══════════════════════════════════════════════════════
// RUIJIE NETWORKS
// ═══════════════════════════════════════════════════════
const RUIJIE: SwitchSeed[] = [
  {
    vendor: "Ruijie Networks", vendorType: "oem", vendorWebsite: "https://www.ruijienetworks.com",
    model: "RG-S6920-4C", series: "RG-S6920", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4, bgpSupport: true, vxlanSupport: true,
    tags: ["datacenter", "spine", "100G"],
  },
  {
    vendor: "Ruijie Networks", vendorType: "oem", vendorWebsite: "https://www.ruijienetworks.com",
    model: "RG-S5760C-24SFP/8GT8XS-X", series: "RG-S5760C", category: "Campus", layer: "L3",
    portsConfig: { "1G_SFP": 24, "1G_RJ45": 8, "10G_SFP+": 8 }, totalPorts: 40,
    maxSpeedGbps: 10, stackingSupport: true,
    tags: ["campus", "aggregation"],
  },
];

// ═══════════════════════════════════════════════════════
// PLANET TECHNOLOGY
// ═══════════════════════════════════════════════════════
const PLANET: SwitchSeed[] = [
  {
    vendor: "Planet Technology", vendorType: "oem", vendorWebsite: "https://www.planet.com.tw",
    model: "GS-6322-24P4X", series: "GS-6322", category: "Campus", layer: "L3",
    portsConfig: { "1G_RJ45": 24, "10G_SFP+": 4 }, totalPorts: 28,
    maxSpeedGbps: 10, poeSupport: "PoE+", stackingSupport: false,
    tags: ["campus", "PoE", "L3-lite"],
  },
  {
    vendor: "Planet Technology", vendorType: "oem", vendorWebsite: "https://www.planet.com.tw",
    model: "IGS-6325-8T8S4X", series: "IGS-6325", category: "Industrial", layer: "L3",
    portsConfig: { "1G_RJ45": 8, "1G_SFP": 8, "10G_SFP+": 4 }, totalPorts: 20,
    maxSpeedGbps: 10,
    tags: ["industrial", "DIN-rail", "IP30"],
  },
];

// ═══════════════════════════════════════════════════════
// LANCOM SYSTEMS
// ═══════════════════════════════════════════════════════
const LANCOM: SwitchSeed[] = [
  {
    vendor: "LANCOM Systems", vendorType: "oem", vendorWebsite: "https://www.lancom-systems.de",
    model: "GS-4554XP", series: "GS-4554", category: "Campus", layer: "L3",
    portsConfig: { "2.5G_RJ45": 48, "10G_SFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 10, poeSupport: "PoE++", stackingSupport: true,
    tags: ["campus", "cloud-managed", "multigigabit"],
  },
];

// ═══════════════════════════════════════════════════════
// CIENA
// ═══════════════════════════════════════════════════════
const CIENA: SwitchSeed[] = [
  {
    vendor: "Ciena", vendorType: "oem", vendorWebsite: "https://www.ciena.com",
    model: "8700 Packetwave", series: "8700", category: "SP", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, mplsSupport: true, bgpSupport: true,
    tags: ["carrier", "DWDM", "packet-optical"],
  },
  {
    vendor: "Ciena", vendorType: "oem", vendorWebsite: "https://www.ciena.com",
    model: "5171", series: "5170", category: "SP", layer: "L2/L3",
    portsConfig: { "100G_QSFP28": 16, "10G_SFP+": 48 }, totalPorts: 64,
    maxSpeedGbps: 100, mplsSupport: true,
    tags: ["carrier", "aggregation", "MEF"],
  },
  {
    vendor: "Ciena", vendorType: "oem", vendorWebsite: "https://www.ciena.com",
    model: "3930", series: "3930", category: "Edge", layer: "L2/L3",
    portsConfig: { "10G_SFP+": 24, "100G_QSFP28": 4 }, totalPorts: 28,
    maxSpeedGbps: 100, mplsSupport: true,
    tags: ["edge", "aggregation", "service-aware"],
  },
];

// ═══════════════════════════════════════════════════════
// ADTRAN / ADVA
// ═══════════════════════════════════════════════════════
const ADTRAN: SwitchSeed[] = [
  {
    vendor: "Adtran", vendorType: "oem", vendorWebsite: "https://www.adtran.com",
    model: "NetVanta 1560-48P", series: "NetVanta 1560", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE+", stackingSupport: true,
    tags: ["campus", "PoE", "SMB"],
  },
  {
    vendor: "Adtran", vendorType: "oem", vendorWebsite: "https://www.adtran.com",
    model: "FSP 3000 CloudConnect", series: "FSP 3000", category: "SP", layer: "L2",
    portsConfig: { "100G_QSFP28": 4, "10G_SFP+": 8 }, totalPorts: 12,
    maxSpeedGbps: 100, mplsSupport: true,
    tags: ["optical", "DWDM", "carrier"],
  },
];

// ═══════════════════════════════════════════════════════
// CALIX
// ═══════════════════════════════════════════════════════
const CALIX: SwitchSeed[] = [
  {
    vendor: "Calix", vendorType: "oem", vendorWebsite: "https://www.calix.com",
    model: "E9-2 Intelligent Edge System", series: "E9-2", category: "Edge", layer: "L2/L3",
    portsConfig: { "10G_SFP+": 16, "1G_RJ45": 48 }, totalPorts: 64,
    maxSpeedGbps: 10,
    tags: ["FTTH", "access", "ISP"],
  },
];

// ═══════════════════════════════════════════════════════
// CAMBIUM NETWORKS
// ═══════════════════════════════════════════════════════
const CAMBIUM: SwitchSeed[] = [
  {
    vendor: "Cambium Networks", vendorType: "oem", vendorWebsite: "https://www.cambiumnetworks.com",
    model: "cnMatrix EX2052-P", series: "cnMatrix EX2052", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE++",
    tags: ["campus", "cloud-managed", "PoE"],
  },
  {
    vendor: "Cambium Networks", vendorType: "oem", vendorWebsite: "https://www.cambiumnetworks.com",
    model: "cnMatrix EX2028-P", series: "cnMatrix EX2028", category: "Campus", layer: "L2",
    portsConfig: { "1G_RJ45": 24, "10G_SFP+": 4 }, totalPorts: 28,
    maxSpeedGbps: 10, poeSupport: "PoE+",
    tags: ["campus", "edge", "PoE"],
  },
];

// ═══════════════════════════════════════════════════════
// AVAYA (ex. Nortel)
// ═══════════════════════════════════════════════════════
const AVAYA: SwitchSeed[] = [
  {
    vendor: "Avaya", vendorType: "oem", vendorWebsite: "https://www.avaya.com",
    model: "VSP 7432CQ", series: "VSP 7400", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4, bgpSupport: true,
    tags: ["datacenter", "fabric", "SPB"],
  },
  {
    vendor: "Avaya", vendorType: "oem", vendorWebsite: "https://www.avaya.com",
    model: "ERS 4950GTS-PWR+", series: "ERS 4950", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 2 }, totalPorts: 50,
    maxSpeedGbps: 10, poeSupport: "PoE+", stackingSupport: true,
    tags: ["campus", "stackable", "PoE"],
  },
];

// ═══════════════════════════════════════════════════════
// FUJITSU
// ═══════════════════════════════════════════════════════
const FUJITSU: SwitchSeed[] = [
  {
    vendor: "Fujitsu", vendorType: "oem", vendorWebsite: "https://www.fujitsu.com",
    model: "FLASHWAVE 9500", series: "FLASHWAVE 9500", category: "SP", layer: "L2",
    portsConfig: { "100G_QSFP28": 20 }, totalPorts: 20,
    maxSpeedGbps: 100,
    tags: ["optical", "DWDM", "carrier", "packet-optical"],
  },
];

// ═══════════════════════════════════════════════════════
// NEC
// ═══════════════════════════════════════════════════════
const NEC: SwitchSeed[] = [
  {
    vendor: "NEC", vendorType: "oem", vendorWebsite: "https://www.nec.com",
    model: "PF5248", series: "PF5200", category: "DataCenter", layer: "L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 3.2, bgpSupport: true,
    tags: ["datacenter", "ToR", "25G"],
  },
];

// ═══════════════════════════════════════════════════════
// JUNIPER (ex. Mist) — Wired Assurance
// ═══════════════════════════════════════════════════════
// Already covered in switch-seed.ts — skip

// ═══════════════════════════════════════════════════════
// RUCKUS / COMMSCOPE
// ═══════════════════════════════════════════════════════
const RUCKUS: SwitchSeed[] = [
  {
    vendor: "Ruckus (CommScope)", vendorType: "oem", vendorWebsite: "https://www.commscope.com/ruckus",
    model: "ICX 7550-48ZP", series: "ICX 7550", category: "Campus", layer: "L3",
    portsConfig: { "2.5G_RJ45": 48, "10G_SFP+": 2, "40G_QSFP+": 2 }, totalPorts: 52,
    maxSpeedGbps: 40, poeSupport: "PoE++", stackingSupport: true,
    tags: ["campus", "multigigabit", "PoE", "WiFi-optimized"],
  },
  {
    vendor: "Ruckus (CommScope)", vendorType: "oem", vendorWebsite: "https://www.commscope.com/ruckus",
    model: "ICX 7150-48PF", series: "ICX 7150", category: "Campus", layer: "L2/L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE+", stackingSupport: true,
    tags: ["campus", "edge", "PoE"],
  },
];

// ═══════════════════════════════════════════════════════
// TRENDNET
// ═══════════════════════════════════════════════════════
const TRENDNET: SwitchSeed[] = [
  {
    vendor: "TRENDnet", vendorType: "oem", vendorWebsite: "https://www.trendnet.com",
    model: "TPE-5048WS", series: "TPE-5048", category: "Campus", layer: "L2",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE+",
    tags: ["SMB", "PoE", "web-smart"],
  },
];

// ═══════════════════════════════════════════════════════
// DRAYTEK
// ═══════════════════════════════════════════════════════
const DRAYTEK: SwitchSeed[] = [
  {
    vendor: "DrayTek", vendorType: "oem", vendorWebsite: "https://www.draytek.com",
    model: "VigorSwitch P2540xs", series: "VigorSwitch", category: "Campus", layer: "L2",
    portsConfig: { "2.5G_RJ45": 48, "10G_SFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 10, poeSupport: "PoE++",
    tags: ["SMB", "multigigabit", "cloud-managed"],
  },
];

// ═══════════════════════════════════════════════════════
// GIGAMON (Monitoring / TAP)
// ═══════════════════════════════════════════════════════
const GIGAMON: SwitchSeed[] = [
  {
    vendor: "Gigamon", vendorType: "oem", vendorWebsite: "https://www.gigamon.com",
    model: "GigaVUE-HC3", series: "GigaVUE-HC3", category: "DataCenter", layer: "L2",
    portsConfig: { "100G_QSFP28": 32, "10G_SFP+": 64 }, totalPorts: 96,
    maxSpeedGbps: 100,
    tags: ["visibility", "TAP", "NPB", "monitoring"],
  },
  {
    vendor: "Gigamon", vendorType: "oem", vendorWebsite: "https://www.gigamon.com",
    model: "GigaVUE-HC1-Plus", series: "GigaVUE-HC1", category: "DataCenter", layer: "L2",
    portsConfig: { "100G_QSFP28": 8, "25G_SFP28": 32 }, totalPorts: 40,
    maxSpeedGbps: 100,
    tags: ["visibility", "TAP", "NPB"],
  },
];

// ═══════════════════════════════════════════════════════
// KEYSIGHT (ex. Ixia)
// ═══════════════════════════════════════════════════════
const KEYSIGHT: SwitchSeed[] = [
  {
    vendor: "Keysight (ex. Ixia)", vendorType: "oem", vendorWebsite: "https://www.keysight.com",
    model: "Vision X", series: "Vision", category: "DataCenter", layer: "L2",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400,
    tags: ["NPB", "visibility", "packet-broker", "TAP"],
  },
];

// ═══════════════════════════════════════════════════════
// SUPERMICRO
// ═══════════════════════════════════════════════════════
const SUPERMICRO: SwitchSeed[] = [
  {
    vendor: "Supermicro", vendorType: "oem", vendorWebsite: "https://www.supermicro.com",
    model: "SSE-C4632SRB", series: "SSE-C4632", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 25.6,
    asicVendor: "Broadcom", asicModel: "Memory Memory",
    sonicCompatible: true, openconfigSupport: true,
    tags: ["whitebox", "SONiC", "400G", "open-networking"],
  },
];

// ═══════════════════════════════════════════════════════
// ADVANTECH
// ═══════════════════════════════════════════════════════
const ADVANTECH: SwitchSeed[] = [
  {
    vendor: "Advantech", vendorType: "oem", vendorWebsite: "https://www.advantech.com",
    model: "EKI-9516G-4GMXP", series: "EKI-9500", category: "Industrial", layer: "L3",
    portsConfig: { "1G_RJ45": 16, "10G_SFP+": 4 }, totalPorts: 20,
    maxSpeedGbps: 10,
    tags: ["industrial", "DIN-rail", "M12", "IP67"],
  },
  {
    vendor: "Advantech", vendorType: "oem", vendorWebsite: "https://www.advantech.com",
    model: "EKI-7720G-4FI", series: "EKI-7720", category: "Industrial", layer: "L2",
    portsConfig: { "1G_RJ45": 16, "1G_SFP": 4 }, totalPorts: 20,
    maxSpeedGbps: 1,
    tags: ["industrial", "DIN-rail", "managed"],
  },
];

// ═══════════════════════════════════════════════════════
// RAD DATA COMMUNICATIONS
// ═══════════════════════════════════════════════════════
const RAD: SwitchSeed[] = [
  {
    vendor: "RAD", vendorType: "oem", vendorWebsite: "https://www.rad.com",
    model: "ETX-2i-10G", series: "ETX-2i", category: "SP", layer: "L2",
    portsConfig: { "10G_SFP+": 10, "1G_RJ45": 8 }, totalPorts: 18,
    maxSpeedGbps: 10, mplsSupport: true,
    tags: ["CPE", "carrier", "demarcation", "MEF"],
  },
];

// ═══════════════════════════════════════════════════════
// ZHONE / DASAN / DZS
// ═══════════════════════════════════════════════════════
const DZS: SwitchSeed[] = [
  {
    vendor: "DZS (ex. Zhone/Dasan)", vendorType: "oem", vendorWebsite: "https://www.dzsi.com",
    model: "OLT 9100", series: "OLT 9100", category: "SP", layer: "L2/L3",
    portsConfig: { "10G_SFP+": 16, "GPON": 16 }, totalPorts: 32,
    maxSpeedGbps: 10,
    tags: ["OLT", "FTTH", "GPON", "ISP"],
  },
];

// ═══════════════════════════════════════════════════════
// ZTE
// ═══════════════════════════════════════════════════════
const ZTE: SwitchSeed[] = [
  {
    vendor: "ZTE", vendorType: "oem", vendorWebsite: "https://www.zte.com.cn",
    model: "ZXR10 9908", series: "ZXR10 9900", category: "Core", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 36 }, totalPorts: 36,
    maxSpeedGbps: 400, switchingCapacityTbps: 28.8, bgpSupport: true, mplsSupport: true,
    tags: ["chassis", "core", "carrier"],
  },
  {
    vendor: "ZTE", vendorType: "oem", vendorWebsite: "https://www.zte.com.cn",
    model: "ZXR10 5960-56PM-H", series: "ZXR10 5960", category: "DataCenter", layer: "L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, bgpSupport: true, vxlanSupport: true,
    tags: ["datacenter", "ToR", "25G"],
  },
];

// ═══════════════════════════════════════════════════════
// FIBERHOME
// ═══════════════════════════════════════════════════════
const FIBERHOME: SwitchSeed[] = [
  {
    vendor: "FiberHome", vendorType: "oem", vendorWebsite: "https://www.fiberhome.com",
    model: "CiTRANS 680", series: "CiTRANS 680", category: "SP", layer: "L2",
    portsConfig: { "100G_QSFP28": 16, "10G_SFP+": 32 }, totalPorts: 48,
    maxSpeedGbps: 100,
    tags: ["carrier", "OTN", "packet-optical"],
  },
];

// ═══════════════════════════════════════════════════════
// DATACOM
// ═══════════════════════════════════════════════════════
const DATACOM: SwitchSeed[] = [
  {
    vendor: "Datacom", vendorType: "oem", vendorWebsite: "https://www.datacom.com.br",
    model: "DM4610-48T6X", series: "DM4610", category: "Campus", layer: "L3",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 10, bgpSupport: true,
    tags: ["campus", "aggregation", "Brazil"],
  },
];

// ═══════════════════════════════════════════════════════
// NETSCOUT / NETWORK INSTRUMENTS
// ═══════════════════════════════════════════════════════
const NETSCOUT: SwitchSeed[] = [
  {
    vendor: "Netscout", vendorType: "oem", vendorWebsite: "https://www.netscout.com",
    model: "nGeniusONE InfiniStreamNG", series: "InfiniStreamNG", category: "DataCenter", layer: "L2",
    portsConfig: { "100G_QSFP28": 8 }, totalPorts: 8,
    maxSpeedGbps: 100,
    tags: ["monitoring", "packet-capture", "NPM"],
  },
];

// ═══════════════════════════════════════════════════════
// CALETA / EVERTZ / RIEDEL (Broadcast/AV)
// ═══════════════════════════════════════════════════════
const BROADCAST_AV: SwitchSeed[] = [
  {
    vendor: "Evertz", vendorType: "oem", vendorWebsite: "https://www.evertz.com",
    model: "EXE-VSR-IP", series: "EXE-VSR", category: "DataCenter", layer: "L2",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100,
    tags: ["broadcast", "SMPTE-2110", "IP-video", "SDI-over-IP"],
  },
  {
    vendor: "Arista", vendorType: "oem", vendorWebsite: "https://www.arista.com",
    model: "7130-48LB", series: "7130", category: "DataCenter", layer: "L2",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100,
    tags: ["broadcast", "SMPTE-2110", "low-latency", "FPGA"],
  },
  {
    vendor: "Riedel Communications", vendorType: "oem", vendorWebsite: "https://www.riedel.net",
    model: "MediorNet MicroN UHD", series: "MediorNet", category: "Edge", layer: "L2",
    portsConfig: { "10G_SFP+": 8 }, totalPorts: 8,
    maxSpeedGbps: 10,
    tags: ["broadcast", "AV-over-IP", "real-time"],
  },
];

// ═══════════════════════════════════════════════════════
// WAYSTREAM
// ═══════════════════════════════════════════════════════
const WAYSTREAM: SwitchSeed[] = [
  {
    vendor: "Waystream", vendorType: "oem", vendorWebsite: "https://www.waystream.com",
    model: "ASR 8000", series: "ASR 8000", category: "SP", layer: "L2/L3",
    portsConfig: { "10G_SFP+": 8, "1G_RJ45": 24 }, totalPorts: 32,
    maxSpeedGbps: 10,
    tags: ["ISP", "access", "FTTH", "triple-play"],
  },
];

// ═══════════════════════════════════════════════════════
// EKINOPS / ONE ACCESS
// ═══════════════════════════════════════════════════════
const EKINOPS: SwitchSeed[] = [
  {
    vendor: "Ekinops", vendorType: "oem", vendorWebsite: "https://www.ekinops.com",
    model: "360-12", series: "OneOS360", category: "Edge", layer: "L3",
    portsConfig: { "10G_SFP+": 12, "1G_RJ45": 4 }, totalPorts: 16,
    maxSpeedGbps: 10, bgpSupport: true, mplsSupport: true,
    tags: ["CPE", "SD-WAN", "carrier-edge"],
  },
];

// ═══════════════════════════════════════════════════════
// RIBBON COMMUNICATIONS (ex. GENBAND/Sonus)
// ═══════════════════════════════════════════════════════
const RIBBON: SwitchSeed[] = [
  {
    vendor: "Ribbon Communications", vendorType: "oem", vendorWebsite: "https://www.ribboncommunications.com",
    model: "Apollo 9900 Series", series: "Apollo 9900", category: "SP", layer: "L2",
    portsConfig: { "100G_QSFP28": 16 }, totalPorts: 16,
    maxSpeedGbps: 100,
    tags: ["optical", "DWDM", "carrier"],
  },
];

// ═══════════════════════════════════════════════════════
// WAGO
// ═══════════════════════════════════════════════════════
const WAGO: SwitchSeed[] = [
  {
    vendor: "WAGO", vendorType: "oem", vendorWebsite: "https://www.wago.com",
    model: "852-1505", series: "852", category: "Industrial", layer: "L2",
    portsConfig: { "1G_RJ45": 8, "1G_SFP": 2 }, totalPorts: 10,
    maxSpeedGbps: 1,
    tags: ["industrial", "DIN-rail", "managed", "PROFINET"],
  },
];

// ═══════════════════════════════════════════════════════
// PEPLINK / PEPWAVE
// ═══════════════════════════════════════════════════════
const PEPLINK: SwitchSeed[] = [
  {
    vendor: "Peplink", vendorType: "oem", vendorWebsite: "https://www.peplink.com",
    model: "SD Switch 24-Port", series: "SD Switch", category: "Campus", layer: "L2",
    portsConfig: { "1G_RJ45": 24, "10G_SFP+": 4 }, totalPorts: 28,
    maxSpeedGbps: 10, poeSupport: "PoE+",
    tags: ["SD-WAN", "cloud-managed", "PoE"],
  },
];

// ═══════════════════════════════════════════════════════
// NETAPP / PURE STORAGE (SAN switches)
// ═══════════════════════════════════════════════════════
const STORAGE_VENDORS: SwitchSeed[] = [
  {
    vendor: "NetApp", vendorType: "oem", vendorWebsite: "https://www.netapp.com",
    model: "CN1610", series: "CN1610", category: "DataCenter", layer: "L2",
    portsConfig: { "10G_SFP+": 16 }, totalPorts: 16,
    maxSpeedGbps: 10,
    tags: ["storage", "cluster-interconnect", "ONTAP"],
  },
  {
    vendor: "QNAP", vendorType: "oem", vendorWebsite: "https://www.qnap.com",
    model: "QSW-M5216-1T", series: "QSW-M5216", category: "DataCenter", layer: "L2",
    portsConfig: { "25G_SFP28": 16, "10G_RJ45": 1 }, totalPorts: 17,
    maxSpeedGbps: 25,
    tags: ["storage", "NAS", "25G"],
  },
  {
    vendor: "Synology", vendorType: "oem", vendorWebsite: "https://www.synology.com",
    model: "SA6400", series: "SA6400", category: "DataCenter", layer: "L2",
    portsConfig: { "25G_SFP28": 4 }, totalPorts: 4,
    maxSpeedGbps: 25,
    tags: ["NAS", "storage", "25G"],
  },
];

// ═══════════════════════════════════════════════════════
// QUANTA CLOUD TECHNOLOGY (QCT)
// ═══════════════════════════════════════════════════════
const QCT: SwitchSeed[] = [
  {
    vendor: "Quanta Cloud Technology", vendorType: "oem", vendorWebsite: "https://www.qct.io",
    model: "QuantaMesh T7064-IX1D", series: "T7064", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 64 }, totalPorts: 64,
    maxSpeedGbps: 100, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", sonicCompatible: true, openconfigSupport: true,
    tags: ["whitebox", "SONiC", "spine", "100G"],
  },
];

// ═══════════════════════════════════════════════════════
// ASTERFUSION
// ═══════════════════════════════════════════════════════
const ASTERFUSION: SwitchSeed[] = [
  {
    vendor: "Asterfusion", vendorType: "oem", vendorWebsite: "https://www.asterfusion.com",
    model: "CX864E-N", series: "CX864", category: "DataCenter", layer: "L3",
    portsConfig: { "800G_OSFP": 64 }, totalPorts: 64,
    maxSpeedGbps: 800, switchingCapacityTbps: 51.2,
    asicVendor: "Broadcom", asicModel: "Tomahawk 5",
    sonicCompatible: true, openconfigSupport: true,
    tags: ["whitebox", "800G", "AI-fabric"],
  },
];

// ═══════════════════════════════════════════════════════
// DELL SONICWALL (Security)
// ═══════════════════════════════════════════════════════
const SONICWALL: SwitchSeed[] = [
  {
    vendor: "SonicWall", vendorType: "oem", vendorWebsite: "https://www.sonicwall.com",
    model: "NSa 6700", series: "NSa 6700", category: "Edge", layer: "L3",
    portsConfig: { "10G_SFP+": 4, "25G_SFP28": 2, "1G_RJ45": 24 }, totalPorts: 30,
    maxSpeedGbps: 25,
    tags: ["firewall", "NGFW", "security"],
  },
];

// ═══════════════════════════════════════════════════════
// WATCHGUARD
// ═══════════════════════════════════════════════════════
const WATCHGUARD: SwitchSeed[] = [
  {
    vendor: "WatchGuard", vendorType: "oem", vendorWebsite: "https://www.watchguard.com",
    model: "Firebox M5800", series: "Firebox M5800", category: "Edge", layer: "L3",
    portsConfig: { "10G_SFP+": 4, "1G_RJ45": 8 }, totalPorts: 12,
    maxSpeedGbps: 10,
    tags: ["firewall", "UTM", "security"],
  },
];

// ═══════════════════════════════════════════════════════
// BARRACUDA
// ═══════════════════════════════════════════════════════
const BARRACUDA: SwitchSeed[] = [
  {
    vendor: "Barracuda Networks", vendorType: "oem", vendorWebsite: "https://www.barracuda.com",
    model: "CloudGen Firewall F900", series: "CGF F900", category: "Edge", layer: "L3",
    portsConfig: { "10G_SFP+": 4, "1G_RJ45": 8 }, totalPorts: 12,
    maxSpeedGbps: 10,
    tags: ["firewall", "SD-WAN", "security"],
  },
];

// ═══════════════════════════════════════════════════════
// SOPHOS
// ═══════════════════════════════════════════════════════
const SOPHOS: SwitchSeed[] = [
  {
    vendor: "Sophos", vendorType: "oem", vendorWebsite: "https://www.sophos.com",
    model: "XGS 6500", series: "XGS 6500", category: "Edge", layer: "L3",
    portsConfig: { "25G_SFP28": 4, "10G_SFP+": 8, "1G_RJ45": 8 }, totalPorts: 20,
    maxSpeedGbps: 25,
    tags: ["firewall", "NGFW", "security", "Xstream"],
  },
  {
    vendor: "Sophos", vendorType: "oem", vendorWebsite: "https://www.sophos.com",
    model: "CS210-48FP", series: "CS210", category: "Campus", layer: "L2",
    portsConfig: { "1G_RJ45": 48, "10G_SFP+": 4 }, totalPorts: 52,
    maxSpeedGbps: 10, poeSupport: "PoE+",
    tags: ["campus", "cloud-managed", "PoE"],
  },
];

// ═══════════════════════════════════════════════════════
// CITRIX / NETSCALER (Load Balancers)
// ═══════════════════════════════════════════════════════
const CITRIX: SwitchSeed[] = [
  {
    vendor: "Citrix (NetScaler)", vendorType: "oem", vendorWebsite: "https://www.citrix.com",
    model: "NetScaler SDX 26000-100G", series: "SDX 26000", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 4, "25G_SFP28": 8 }, totalPorts: 12,
    maxSpeedGbps: 100,
    tags: ["ADC", "load-balancer", "SSL"],
  },
];

// ═══════════════════════════════════════════════════════
// KEMP (Load Balancers)
// ═══════════════════════════════════════════════════════
const KEMP: SwitchSeed[] = [
  {
    vendor: "Kemp Technologies", vendorType: "oem", vendorWebsite: "https://www.kemp.ax",
    model: "LoadMaster LM-X40", series: "LoadMaster", category: "DataCenter", layer: "L3",
    portsConfig: { "40G_QSFP+": 4, "10G_SFP+": 8 }, totalPorts: 12,
    maxSpeedGbps: 40,
    tags: ["ADC", "load-balancer"],
  },
];

// ═══════════════════════════════════════════════════════
// A10 NETWORKS
// ═══════════════════════════════════════════════════════
const A10: SwitchSeed[] = [
  {
    vendor: "A10 Networks", vendorType: "oem", vendorWebsite: "https://www.a10networks.com",
    model: "Thunder 14045", series: "Thunder", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 8, "25G_SFP28": 16 }, totalPorts: 24,
    maxSpeedGbps: 100,
    tags: ["ADC", "DDoS", "load-balancer", "CGN"],
  },
];

// ═══════════════════════════════════════════════════════
// NIC VENDORS (Intel, Broadcom, Chelsio, Solarflare)
// ═══════════════════════════════════════════════════════
const NIC_VENDORS: SwitchSeed[] = [
  {
    vendor: "Intel", vendorType: "oem", vendorWebsite: "https://www.intel.com",
    model: "E810-CQDA2", series: "E810", category: "DataCenter", layer: "L2",
    portsConfig: { "100G_QSFP28": 2 }, totalPorts: 2,
    maxSpeedGbps: 100,
    tags: ["NIC", "SmartNIC", "DPDK", "iWARP"],
  },
  {
    vendor: "Broadcom", vendorType: "oem", vendorWebsite: "https://www.broadcom.com",
    model: "BCM957508-P2100G", series: "BCM957508", category: "DataCenter", layer: "L2",
    portsConfig: { "100G_QSFP56": 2 }, totalPorts: 2,
    maxSpeedGbps: 100,
    tags: ["NIC", "SmartNIC", "RoCE"],
  },
  {
    vendor: "NVIDIA Networking", vendorType: "oem", vendorWebsite: "https://www.nvidia.com/networking",
    model: "ConnectX-7 400G", series: "ConnectX-7", category: "DataCenter", layer: "L2",
    portsConfig: { "400G_QSFP-DD": 1 }, totalPorts: 1,
    maxSpeedGbps: 400,
    tags: ["NIC", "SmartNIC", "InfiniBand", "DPU", "AI"],
  },
];

// ═══════════════════════════════════════════════════════
// COMBINE ALL SEEDS
// ═══════════════════════════════════════════════════════
const ALL_BULK_SEEDS: SwitchSeed[] = [
  ...DLINK,
  ...ALE,
  ...BROCADE,
  ...H3C,
  ...RUIJIE,
  ...PLANET,
  ...LANCOM,
  ...CIENA,
  ...ADTRAN,
  ...CALIX,
  ...CAMBIUM,
  ...AVAYA,
  ...FUJITSU,
  ...NEC,
  ...RUCKUS,
  ...TRENDNET,
  ...DRAYTEK,
  ...GIGAMON,
  ...KEYSIGHT,
  ...SUPERMICRO,
  ...ADVANTECH,
  ...RAD,
  ...DZS,
  ...ZTE,
  ...FIBERHOME,
  ...DATACOM,
  ...NETSCOUT,
  ...BROADCAST_AV,
  ...WAYSTREAM,
  ...EKINOPS,
  ...RIBBON,
  ...WAGO,
  ...PEPLINK,
  ...STORAGE_VENDORS,
  ...QCT,
  ...ASTERFUSION,
  ...SONICWALL,
  ...WATCHGUARD,
  ...BARRACUDA,
  ...SOPHOS,
  ...CITRIX,
  ...KEMP,
  ...A10,
  ...NIC_VENDORS,
];

// ═══════════════════════════════════════════════════════
// Seed function
// ═══════════════════════════════════════════════════════
export async function seedBulkSwitches(): Promise<void> {
  console.log(`\n=== Seeding ${ALL_BULK_SEEDS.length} Bulk Switch/Router Models ===\n`);

  const vendorCache = new Map<string, string>();
  let created = 0;
  let updated = 0;

  for (const sw of ALL_BULK_SEEDS) {
    try {
      let vendorId = vendorCache.get(sw.vendor);
      if (!vendorId) {
        vendorId = await ensureVendor(sw.vendor, sw.vendorType, sw.vendorWebsite);
        vendorCache.set(sw.vendor, vendorId);
      }

      const existing = await pool.query(
        `SELECT id FROM switches WHERE model = $1 AND vendor_id = $2`,
        [sw.model, vendorId]
      );

      await findOrCreateSwitch({
        model: sw.model,
        vendorId,
        series: sw.series,
        category: sw.category,
        layer: sw.layer,
        portsConfig: sw.portsConfig,
        totalPorts: sw.totalPorts,
        uplinkSpeedGbps: sw.uplinkSpeedGbps,
        maxSpeedGbps: sw.maxSpeedGbps,
        switchingCapacityTbps: sw.switchingCapacityTbps,
        forwardingRateMpps: sw.forwardingRateMpps,
        asicVendor: sw.asicVendor,
        asicModel: sw.asicModel,
        rackUnits: sw.rackUnits,
        maxPowerW: sw.maxPowerW,
        poeSupport: sw.poeSupport,
        stackingSupport: sw.stackingSupport,
        vxlanSupport: sw.vxlanSupport,
        evpnSupport: sw.evpnSupport,
        bgpSupport: sw.bgpSupport,
        mplsSupport: sw.mplsSupport,
        openconfigSupport: sw.openconfigSupport,
        sonicCompatible: sw.sonicCompatible,
        macsecSupport: sw.macsecSupport,
        tags: sw.tags,
      });

      if (existing.rows.length > 0) {
        updated++;
      } else {
        created++;
        console.log(`  ✓ ${sw.vendor} ${sw.model}`);
      }
    } catch (err: unknown) {
      const msg = err instanceof Error ? err.message : String(err);
      console.error(`  ✗ ${sw.vendor} ${sw.model}: ${msg}`);
    }
  }

  console.log(`\n=== Bulk Seed Complete: ${created} created, ${updated} updated ===`);
}

if (require.main === module) {
  seedBulkSwitches()
    .then(() => pool.end())
    .catch((err) => { console.error("Fatal:", err); pool.end(); process.exit(1); });
}
