/**
 * Whitebox / Open Networking Switch Seed Data
 *
 * Comprehensive catalog of whitebox ODM/OEM switches from:
 * Edgecore, Celestica, Delta, QCT, Inventec, UfiSpace, Asterfusion, Netberg, Ragile
 *
 * Sources: Public datasheets, SONiC HCL, OCP specs, vendor product pages.
 */
import { pool, ensureWhiteboxVendor, findOrCreateSwitch } from "../utils/db";
import type { SwitchParams } from "../utils/db";

interface WhiteboxSeed {
  vendor: string;
  vendorWebsite: string;
  vendorOpts: { isOdm: boolean; ocpMember: boolean; sonicContributor: boolean };
  model: string;
  series: string;
  category: "DataCenter" | "Campus" | "Edge" | "Core" | "SP" | "Industrial";
  layer: "L2" | "L3" | "L2/L3";
  portsConfig: Record<string, number>;
  totalPorts: number;
  maxSpeedGbps: number;
  switchingCapacityTbps?: number;
  forwardingRateMpps?: number;
  asicVendor: string;
  asicModel: string;
  asicSeries?: string;
  rackUnits?: number;
  maxPowerW?: number;
  cpu?: string;
  cpuCores?: number;
  ramGb?: number;
  storageGb?: number;
  storageType?: string;
  sonicCompatible: boolean;
  onlCompatible?: boolean;
  cumulusCompatible?: boolean;
  dentCompatible?: boolean;
  fbossCompatible?: boolean;
  onieSupport?: boolean;
  ocpStatus?: "Accepted" | "Inspired" | "None";
  supportedNos?: string[];
  sonicHwsku?: string;
  transceiverFormFactors: string[];
  catalogUrl?: string;
  tags: string[];
}

// ═══════════════════════════════════════════════════════
// EDGECORE NETWORKS (Accton subsidiary)
// ═══════════════════════════════════════════════════════
const EDGECORE: WhiteboxSeed[] = [
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AS7946-74XKDB", series: "AS7946", category: "DataCenter", layer: "L3",
    portsConfig: { "800G_OSFP": 74 }, totalPorts: 74,
    maxSpeedGbps: 800, switchingCapacityTbps: 59.2,
    asicVendor: "Broadcom", asicModel: "Tomahawk 5", asicSeries: "memory Memory",
    rackUnits: 2, maxPowerW: 3500,
    cpu: "Intel Xeon D-1649N", cpuCores: 8, ramGb: 32, storageGb: 128, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "ONL", "FBOSS", "DENT"],
    sonicHwsku: "Edgecore-AS7946-74XKDB",
    transceiverFormFactors: ["OSFP"],
    catalogUrl: "https://www.edge-core.com/product/as7946-74xkdb/",
    tags: ["800G", "whitebox", "spine", "AI-fabric", "OCP", "Tomahawk5"],
  },
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AS9516-32D", series: "AS9516", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 1800,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "ONL", "Cumulus", "FBOSS"],
    sonicHwsku: "Edgecore-AS9516-32D",
    transceiverFormFactors: ["QSFP-DD"],
    catalogUrl: "https://www.edge-core.com/product/as9516-32d/",
    tags: ["400G", "whitebox", "spine", "OCP", "Tomahawk3"],
  },
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AS7726-32X", series: "AS7726", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32, "10G_SFP+": 2 }, totalPorts: 34,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4, forwardingRateMpps: 4760,
    asicVendor: "Broadcom", asicModel: "Trident III", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 460,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, cumulusCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "ONL", "Cumulus", "DENT", "FBOSS"],
    sonicHwsku: "Edgecore-AS7726-32X",
    transceiverFormFactors: ["QSFP28", "SFP+"],
    catalogUrl: "https://www.edge-core.com/product/as7726-32x/",
    tags: ["100G", "whitebox", "leaf", "spine", "OCP", "Trident3"],
  },
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AS7712-32X", series: "AS7712", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4, forwardingRateMpps: 4760,
    asicVendor: "Broadcom", asicModel: "Tomahawk", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 460,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, cumulusCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "ONL", "Cumulus", "FBOSS"],
    sonicHwsku: "Edgecore-AS7712-32X",
    transceiverFormFactors: ["QSFP28"],
    catalogUrl: "https://www.edge-core.com/product/as7712-32x/",
    tags: ["100G", "whitebox", "leaf", "spine", "OCP", "Tomahawk"],
  },
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "DCS204", series: "DCS200", category: "DataCenter", layer: "L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.0,
    asicVendor: "Broadcom", asicModel: "Trident III", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 450,
    cpu: "Intel Atom C3558", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    ocpStatus: "Inspired",
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
  {
    vendor: "Edgecore Networks", vendorWebsite: "https://www.edge-core.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "Minipack2", series: "Minipack", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 128 }, totalPorts: 128,
    maxSpeedGbps: 400, switchingCapacityTbps: 51.2,
    asicVendor: "Broadcom", asicModel: "Memory Tomahawk 4", asicSeries: "memory Memory",
    rackUnits: 4, maxPowerW: 5000,
    cpu: "Intel Xeon D-1649N", cpuCores: 8, ramGb: 32, storageGb: 128, storageType: "SSD",
    sonicCompatible: true, fbossCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "FBOSS"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "modular", "chassis", "OCP", "Meta"],
  },
];

// ═══════════════════════════════════════════════════════
// CELESTICA
// ═══════════════════════════════════════════════════════
const CELESTICA: WhiteboxSeed[] = [
  {
    vendor: "Celestica", vendorWebsite: "https://www.celestica.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "DS5000", series: "DS5000", category: "DataCenter", layer: "L3",
    portsConfig: { "800G_OSFP": 64 }, totalPorts: 64,
    maxSpeedGbps: 800, switchingCapacityTbps: 51.2,
    asicVendor: "Broadcom", asicModel: "Tomahawk 5", asicSeries: "memory Memory",
    rackUnits: 2, maxPowerW: 3200,
    cpu: "Intel Xeon D-1649N", cpuCores: 8, ramGb: 32, storageGb: 128, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    ocpStatus: "Inspired",
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["OSFP"],
    tags: ["800G", "whitebox", "spine", "AI-fabric", "Tomahawk5"],
  },
  {
    vendor: "Celestica", vendorWebsite: "https://www.celestica.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "DS4000", series: "DS4000", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 4", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 1500,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    ocpStatus: "Inspired",
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine", "Tomahawk4"],
  },
  {
    vendor: "Celestica", vendorWebsite: "https://www.celestica.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "Seastone2", series: "Seastone", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Broadcom", asicModel: "Tomahawk", asicSeries: "memory Memory",
    rackUnits: 1, maxPowerW: 460,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    ocpStatus: "Accepted",
    supportedNos: ["SONiC", "ONL", "Cumulus"],
    sonicHwsku: "Celestica-Seastone2",
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "leaf", "spine", "OCP"],
  },
  {
    vendor: "Celestica", vendorWebsite: "https://www.celestica.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "Midstone-200i", series: "Midstone", category: "DataCenter", layer: "L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.0,
    asicVendor: "Broadcom", asicModel: "Trident III",
    rackUnits: 1, maxPowerW: 450,
    cpu: "Intel Atom C3558", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
];

// ═══════════════════════════════════════════════════════
// DELTA NETWORKS
// ═══════════════════════════════════════════════════════
const DELTA: WhiteboxSeed[] = [
  {
    vendor: "Delta Networks", vendorWebsite: "https://www.deltaww.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AG9064v2", series: "AG9064", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 64 }, totalPorts: 64,
    maxSpeedGbps: 400, switchingCapacityTbps: 25.6,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 2, maxPowerW: 2500,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    sonicHwsku: "Delta-AG9064v2",
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine", "Tomahawk3"],
  },
  {
    vendor: "Delta Networks", vendorWebsite: "https://www.deltaww.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AG9032v2A", series: "AG9032", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Broadcom", asicModel: "Tomahawk+",
    rackUnits: 1, maxPowerW: 480,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL", "DENT"],
    sonicHwsku: "Delta-AG9032v2A",
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "leaf", "spine"],
  },
  {
    vendor: "Delta Networks", vendorWebsite: "https://www.deltaww.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AGC7648A", series: "AGC7648", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 6 }, totalPorts: 54,
    maxSpeedGbps: 100, switchingCapacityTbps: 1.8,
    asicVendor: "Broadcom", asicModel: "Trident III",
    rackUnits: 1, maxPowerW: 420,
    cpu: "Intel Atom C3558", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
  {
    vendor: "Delta Networks", vendorWebsite: "https://www.deltaww.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "AG5648", series: "AG5648", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "10G_SFP+": 48, "40G_QSFP+": 6 }, totalPorts: 54,
    maxSpeedGbps: 40, switchingCapacityTbps: 0.72,
    asicVendor: "Broadcom", asicModel: "Memory Memory",
    rackUnits: 1, maxPowerW: 350,
    sonicCompatible: true, onlCompatible: true, dentCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL", "DENT"],
    transceiverFormFactors: ["SFP+", "QSFP+"],
    tags: ["10G", "whitebox", "campus", "enterprise", "DENT"],
  },
];

// ═══════════════════════════════════════════════════════
// QUANTA CLOUD TECHNOLOGY (QCT)
// ═══════════════════════════════════════════════════════
const QCT: WhiteboxSeed[] = [
  {
    vendor: "Quanta Cloud Technology", vendorWebsite: "https://www.qct.io",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "QuantaMesh T9032-IX9", series: "QuantaMesh T9032", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 1, maxPowerW: 1500,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    sonicHwsku: "QuantaMesh-T9032-IX9",
    transceiverFormFactors: ["QSFP-DD"],
    catalogUrl: "https://www.qct.io/product/index/Networking",
    tags: ["400G", "whitebox", "spine", "Tomahawk3"],
  },
  {
    vendor: "Quanta Cloud Technology", vendorWebsite: "https://www.qct.io",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "QuantaMesh T7064-IX4", series: "QuantaMesh T7064", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 64 }, totalPorts: 64,
    maxSpeedGbps: 100, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 2",
    rackUnits: 2, maxPowerW: 900,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL", "Cumulus"],
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "spine", "Tomahawk2"],
  },
  {
    vendor: "Quanta Cloud Technology", vendorWebsite: "https://www.qct.io",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "QuantaMesh T7032-IX1", series: "QuantaMesh T7032", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Broadcom", asicModel: "Tomahawk",
    rackUnits: 1, maxPowerW: 460,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onlCompatible: true, cumulusCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL", "Cumulus"],
    sonicHwsku: "QuantaMesh-T7032-IX1",
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "leaf", "spine"],
  },
  {
    vendor: "Quanta Cloud Technology", vendorWebsite: "https://www.qct.io",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "QuantaMesh T3048-LY8", series: "QuantaMesh T3048", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.0,
    asicVendor: "Broadcom", asicModel: "Trident III",
    rackUnits: 1, maxPowerW: 420,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
];

// ═══════════════════════════════════════════════════════
// UFISPACE
// ═══════════════════════════════════════════════════════
const UFISPACE: WhiteboxSeed[] = [
  {
    vendor: "UfiSpace", vendorWebsite: "https://www.ufispace.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "S9600-72XC", series: "S9600", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 72 }, totalPorts: 72,
    maxSpeedGbps: 100, switchingCapacityTbps: 14.4,
    asicVendor: "Broadcom", asicModel: "Jericho2",
    rackUnits: 2, maxPowerW: 1200,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    sonicHwsku: "UfiSpace-S9600-72XC",
    transceiverFormFactors: ["QSFP28"],
    catalogUrl: "https://www.ufispace.com/products/datacenter-switches",
    tags: ["100G", "whitebox", "spine", "Jericho2", "deep-buffer"],
  },
  {
    vendor: "UfiSpace", vendorWebsite: "https://www.ufispace.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "S9600-32X", series: "S9600", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Broadcom", asicModel: "Tomahawk",
    rackUnits: 1, maxPowerW: 460,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 8, storageGb: 32, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "leaf", "spine"],
  },
  {
    vendor: "UfiSpace", vendorWebsite: "https://www.ufispace.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "S9700-53DX", series: "S9700", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32, "100G_QSFP28": 20 }, totalPorts: 52,
    maxSpeedGbps: 400, switchingCapacityTbps: 14.8,
    asicVendor: "Broadcom", asicModel: "Jericho2",
    rackUnits: 2, maxPowerW: 2000,
    cpu: "Intel Xeon D-1649N", cpuCores: 8, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP-DD", "QSFP28"],
    tags: ["400G", "whitebox", "disaggregated", "chassis", "DDC"],
  },
  {
    vendor: "UfiSpace", vendorWebsite: "https://www.ufispace.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "S9510-28DC", series: "S9510", category: "Edge", layer: "L3",
    portsConfig: { "100G_QSFP28": 20, "10G_SFP+": 8 }, totalPorts: 28,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.4,
    asicVendor: "Broadcom", asicModel: "Memory Trident III",
    rackUnits: 1, maxPowerW: 350,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP28", "SFP+"],
    tags: ["cell-site", "whitebox", "edge", "DCSG", "telecom"],
  },
  {
    vendor: "UfiSpace", vendorWebsite: "https://www.ufispace.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "S9600-30DX", series: "S9600", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 30, "10G_SFP+": 2 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.0,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 1, maxPowerW: 1500,
    cpu: "Intel Xeon D-1527", cpuCores: 4, ramGb: 16, storageGb: 64, storageType: "SSD",
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP-DD", "SFP+"],
    tags: ["400G", "whitebox", "spine", "Tomahawk3"],
  },
];

// ═══════════════════════════════════════════════════════
// INVENTEC
// ═══════════════════════════════════════════════════════
const INVENTEC: WhiteboxSeed[] = [
  {
    vendor: "Inventec", vendorWebsite: "https://www.inventec.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "D7332", series: "D7332", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 1, maxPowerW: 1500,
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine"],
  },
  {
    vendor: "Inventec", vendorWebsite: "https://www.inventec.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "D7264Q28B", series: "D7264", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 64 }, totalPorts: 64,
    maxSpeedGbps: 100, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 2",
    rackUnits: 2, maxPowerW: 900,
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    sonicHwsku: "Inventec-D7264Q28B",
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "spine", "Tomahawk2"],
  },
  {
    vendor: "Inventec", vendorWebsite: "https://www.inventec.com",
    vendorOpts: { isOdm: true, ocpMember: true, sonicContributor: true },
    model: "D7054Q28B", series: "D7054", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 6 }, totalPorts: 54,
    maxSpeedGbps: 100, switchingCapacityTbps: 1.8,
    asicVendor: "Broadcom", asicModel: "Trident III",
    rackUnits: 1, maxPowerW: 420,
    sonicCompatible: true, onlCompatible: true, onieSupport: true,
    supportedNos: ["SONiC", "ONL"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
];

// ═══════════════════════════════════════════════════════
// ASTERFUSION
// ═══════════════════════════════════════════════════════
const ASTERFUSION: WhiteboxSeed[] = [
  {
    vendor: "Asterfusion", vendorWebsite: "https://www.asterfusion.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "CX864E-N", series: "CX864", category: "DataCenter", layer: "L3",
    portsConfig: { "800G_OSFP": 64 }, totalPorts: 64,
    maxSpeedGbps: 800, switchingCapacityTbps: 51.2,
    asicVendor: "Marvell", asicModel: "Teralynx 10",
    rackUnits: 2, maxPowerW: 3000,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["OSFP"],
    tags: ["800G", "whitebox", "spine", "AI-fabric", "Marvell"],
  },
  {
    vendor: "Asterfusion", vendorWebsite: "https://www.asterfusion.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "CX732Q-N", series: "CX732", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Marvell", asicModel: "Teralynx 7",
    rackUnits: 1, maxPowerW: 1500,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine", "Marvell"],
  },
  {
    vendor: "Asterfusion", vendorWebsite: "https://www.asterfusion.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "CX564P-N", series: "CX564", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 64 }, totalPorts: 64,
    maxSpeedGbps: 100, switchingCapacityTbps: 12.8,
    asicVendor: "Marvell", asicModel: "Teralynx 7",
    rackUnits: 2, maxPowerW: 800,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "spine", "Marvell"],
  },
  {
    vendor: "Asterfusion", vendorWebsite: "https://www.asterfusion.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "CX532P-N", series: "CX532", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32, "10G_SFP+": 2 }, totalPorts: 34,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Marvell", asicModel: "Teralynx",
    rackUnits: 1, maxPowerW: 460,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP28", "SFP+"],
    tags: ["100G", "whitebox", "leaf", "spine", "Marvell"],
  },
  {
    vendor: "Asterfusion", vendorWebsite: "https://www.asterfusion.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "CX308P-48Y-N", series: "CX308", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.0,
    asicVendor: "Marvell", asicModel: "Prestera",
    rackUnits: 1, maxPowerW: 400,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf", "Marvell"],
  },
];

// ═══════════════════════════════════════════════════════
// NETBERG
// ═══════════════════════════════════════════════════════
const NETBERG: WhiteboxSeed[] = [
  {
    vendor: "Netberg", vendorWebsite: "https://netbergtw.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "Aurora 810", series: "Aurora", category: "DataCenter", layer: "L3",
    portsConfig: { "800G_OSFP": 64 }, totalPorts: 64,
    maxSpeedGbps: 800, switchingCapacityTbps: 51.2,
    asicVendor: "Broadcom", asicModel: "Tomahawk 5",
    rackUnits: 2, maxPowerW: 3200,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["OSFP"],
    tags: ["800G", "whitebox", "spine", "AI-fabric", "Tomahawk5"],
  },
  {
    vendor: "Netberg", vendorWebsite: "https://netbergtw.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "Aurora 750", series: "Aurora", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 1, maxPowerW: 1500,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine", "Tomahawk3"],
  },
  {
    vendor: "Netberg", vendorWebsite: "https://netbergtw.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "Aurora 620", series: "Aurora", category: "DataCenter", layer: "L3",
    portsConfig: { "100G_QSFP28": 32 }, totalPorts: 32,
    maxSpeedGbps: 100, switchingCapacityTbps: 6.4,
    asicVendor: "Broadcom", asicModel: "Tomahawk",
    rackUnits: 1, maxPowerW: 460,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP28"],
    tags: ["100G", "whitebox", "leaf", "spine"],
  },
];

// ═══════════════════════════════════════════════════════
// RAGILE NETWORKS
// ═══════════════════════════════════════════════════════
const RAGILE: WhiteboxSeed[] = [
  {
    vendor: "Ragile Networks", vendorWebsite: "https://www.ragilenetworks.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "RA-B6920-4S", series: "RA-B6920", category: "DataCenter", layer: "L3",
    portsConfig: { "400G_QSFP-DD": 32 }, totalPorts: 32,
    maxSpeedGbps: 400, switchingCapacityTbps: 12.8,
    asicVendor: "Broadcom", asicModel: "Tomahawk 3",
    rackUnits: 1, maxPowerW: 1500,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["QSFP-DD"],
    tags: ["400G", "whitebox", "spine"],
  },
  {
    vendor: "Ragile Networks", vendorWebsite: "https://www.ragilenetworks.com",
    vendorOpts: { isOdm: true, ocpMember: false, sonicContributor: true },
    model: "RA-B6510-48V8C", series: "RA-B6510", category: "DataCenter", layer: "L2/L3",
    portsConfig: { "25G_SFP28": 48, "100G_QSFP28": 8 }, totalPorts: 56,
    maxSpeedGbps: 100, switchingCapacityTbps: 2.0,
    asicVendor: "Broadcom", asicModel: "Trident III",
    rackUnits: 1, maxPowerW: 420,
    sonicCompatible: true, onieSupport: true,
    supportedNos: ["SONiC"],
    transceiverFormFactors: ["SFP28", "QSFP28"],
    tags: ["25G", "whitebox", "ToR", "leaf"],
  },
];

// ═══════════════════════════════════════════════════════
// SEED FUNCTION
// ═══════════════════════════════════════════════════════

const ALL_WHITEBOX = [
  ...EDGECORE, ...CELESTICA, ...DELTA, ...QCT,
  ...UFISPACE, ...INVENTEC, ...ASTERFUSION, ...NETBERG, ...RAGILE,
];

export async function seedWhiteboxSwitches(): Promise<void> {
  console.log(`\n=== Seeding ${ALL_WHITEBOX.length} Whitebox Switches ===\n`);
  let created = 0;
  let updated = 0;

  for (const sw of ALL_WHITEBOX) {
    try {
      const vendorId = await ensureWhiteboxVendor(sw.vendor, sw.vendorWebsite, sw.vendorOpts);

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

      await findOrCreateSwitch({
        model: sw.model,
        vendorId,
        series: sw.series,
        category: sw.category,
        layer: sw.layer,
        portsConfig: sw.portsConfig,
        totalPorts: sw.totalPorts,
        maxSpeedGbps: sw.maxSpeedGbps,
        switchingCapacityTbps: sw.switchingCapacityTbps,
        forwardingRateMpps: sw.forwardingRateMpps,
        asicVendor: sw.asicVendor,
        asicModel: sw.asicModel,
        asicSeries: sw.asicSeries,
        rackUnits: sw.rackUnits,
        maxPowerW: sw.maxPowerW,
        sonicCompatible: sw.sonicCompatible,
        tags: sw.tags,
        // Whitebox fields
        isWhitebox: true,
        isOcpAccepted: sw.ocpStatus === "Accepted",
        ocpStatus: sw.ocpStatus || "None",
        supportedNos: sw.supportedNos || [],
        onlCompatible: sw.onlCompatible,
        dentCompatible: sw.dentCompatible,
        cumulusCompatible: sw.cumulusCompatible,
        fbossCompatible: sw.fbossCompatible,
        cpu: sw.cpu,
        cpuCores: sw.cpuCores,
        ramGb: sw.ramGb,
        storageGb: sw.storageGb,
        storageType: sw.storageType,
        transceiverFormFactors: sw.transceiverFormFactors,
        catalogUrl: sw.catalogUrl,
        sonicHwsku: sw.sonicHwsku,
        onieSupport: sw.onieSupport,
        scrapeSource: "whitebox-seed",
      });

      if (isNew) {
        created++;
        console.log(`  + ${sw.vendor} ${sw.model} (${sw.maxSpeedGbps}G, ${sw.asicVendor} ${sw.asicModel})`);
      } else {
        updated++;
      }
    } catch (err) {
      console.error(`  ! Error seeding ${sw.vendor} ${sw.model}:`, err);
    }
  }

  console.log(`\n  Created: ${created}, Updated: ${updated}, Total: ${ALL_WHITEBOX.length}\n`);
}
