// ============================================================
// Product catalog + site config
// ============================================================
// Three series, multiple SKUs each.

// ---- Site configuration (edit these to update site-wide contact info) ----
const SITE = {
  whatsappNumber: '919876543210', // country code + number, no + or spaces
  whatsappDisplay: '+91 98765 43210',
  email: 'sales@vividpix.in',
  supportEmail: 'help@vividpix.in',
  phone: '+91 80 4567 8901',
  address: '4B, Indiranagar 1st Stage, Bengaluru 560038',
  gstin: '29AAACV1234A1Z5',
  whatsappHours: 'Mon–Sat · 9 AM – 7 PM IST',
};

// ---- WhatsApp link helpers ----
function waUrl(message) {
  return `https://wa.me/${SITE.whatsappNumber}?text=${encodeURIComponent(message)}`;
}

function waGeneralEnquiry() {
  return waUrl("Hi VividPix! I'd like to know more about your LED displays.");
}

function waProductEnquiry(p) {
  const msg = `Hi VividPix! I'm interested in the *${p.name}* (${p.sku})\nSize: ${p.size}\nPrice: ${formatPrice(p.price)}\n\nCould you share more details and confirm availability?`;
  return waUrl(msg);
}

function waCartEnquiry(items) {
  const subtotal = items.reduce((s, it) => s + it.price * it.qty, 0);
  const lines = items.map(it => `• ${it.qty} × ${it.name} (${it.sku}) — ${formatPrice(it.price * it.qty)}`);
  const msg = `Hi VividPix! I'd like to order the following:\n\n${lines.join('\n')}\n\n*Subtotal: ${formatPrice(subtotal)}*\n\nPlease confirm availability and share installation / shipping details.`;
  return waUrl(msg);
}

const SERIES = [
  {
    id: 'lumen',
    name: 'Lumen',
    tagline: 'Compact signage that reads from across the room.',
    short: 'Compact',
    description: 'Slim, indoor-rated LED panels for retail counters, café boards, queue displays and reception desks. The smallest in the lineup — easy to install, easy on the eye.',
    badge: 'Compact · Indoor',
    accent: '#E13F92',
    sizeRange: '2 × 0.5 ft → 3 × 0.5 ft',
    color: ['Monochrome', '3-bit color'],
    pitch: 'P4 · P5',
    use: ['Retail counters', 'Café menus', 'Queue tokens', 'Reception'],
    heroFx: { kind: 'text', text: 'NOW OPEN', color: '#FF4FB5' },
  },
  {
    id: 'chroma',
    name: 'Chroma',
    tagline: 'Full-color storytelling at retail scale.',
    short: 'Mid',
    description: 'The workhorse of the range. 12-bit full color, sharp pitch, and a frame thin enough to mount almost anywhere. Built for storefronts, lobbies and event venues that want photo-quality output.',
    badge: 'Full Color · Indoor / Sheltered',
    accent: '#9F2BD6',
    sizeRange: '3 × 1 ft → 4 × 1 ft',
    color: ['3-bit color', '12-bit full color'],
    pitch: 'P3 · P4',
    use: ['Storefronts', 'Lobbies', 'Event venues', 'Showrooms'],
    heroFx: { kind: 'plasma' },
  },
  {
    id: 'beacon',
    name: 'Beacon',
    tagline: 'Outdoor-rated brightness, weather-sealed body.',
    short: 'Pro',
    description: 'IP-rated outdoor displays engineered for direct sunlight, monsoon spray and full-day signage duty. Rugged powder-coated chassis, surge-protected PSU, and a brightness curve tuned for facades.',
    badge: 'IP65 · Outdoor',
    accent: '#6D0FC5',
    sizeRange: '4 × 1 ft → 5 × 1.5 ft',
    color: ['12-bit full color'],
    pitch: 'P5 · P6 · P8',
    use: ['Facade signage', 'Petrol stations', 'Stadium edges', 'Wayfinding'],
    heroFx: { kind: 'rainbow' },
  },
];

const PRODUCTS = [
  // Lumen series
  {
    id: 'lumen-20',
    sku: 'LMCEM02D05BP32M0',
    series: 'lumen',
    name: 'Lumen 20',
    size: '2 × 0.5 ft',
    resolution: '96 × 24',
    color: 'Monochrome',
    pitch: 'P5',
    price: 8990,
    image: 'assets/3x1-front.png',
    images: ['assets/3x1-front.png', 'assets/3x1-angle.png'],
    short: 'Crisp scrolling text and icons in vivid magenta.',
    inStock: true,
    badge: 'Bestseller',
  },
  {
    id: 'lumen-30',
    sku: 'LMCEM03D05BP32M0',
    series: 'lumen',
    name: 'Lumen 30',
    size: '3 × 0.5 ft',
    resolution: '144 × 24',
    color: '3-bit color',
    pitch: 'P5',
    price: 12990,
    image: 'assets/3x1-angle.png',
    images: ['assets/3x1-angle.png', 'assets/3x1-front.png'],
    short: '8-color palette, perfect for menu boards and counters.',
    inStock: true,
  },
  // Chroma series
  {
    id: 'chroma-30',
    sku: 'LMCEC03D10BP32L0',
    series: 'chroma',
    name: 'Chroma 30',
    size: '3 × 1 ft',
    resolution: '192 × 64',
    color: '12-bit full color',
    pitch: 'P4',
    price: 24990,
    image: 'assets/3x1-front.png',
    images: ['assets/3x1-front.png', 'assets/3x1-angle.png', 'assets/all-displays.png'],
    short: 'Photo-quality color with 4,096 shades per channel.',
    inStock: true,
    badge: 'New',
  },
  {
    id: 'chroma-40',
    sku: 'LMCEC04D10BP32L0',
    series: 'chroma',
    name: 'Chroma 40',
    size: '4 × 1 ft',
    resolution: '256 × 64',
    color: '12-bit full color',
    pitch: 'P4',
    price: 32990,
    image: 'assets/3x1-angle.png',
    images: ['assets/3x1-angle.png', 'assets/3x1-front.png'],
    short: 'A wider canvas for richer animations and full-bleed GIFs.',
    inStock: true,
  },
  // Beacon series
  {
    id: 'beacon-40',
    sku: 'LMCEC04D12BP65H0',
    series: 'beacon',
    name: 'Beacon 40',
    size: '4 × 1 ft',
    resolution: '192 × 48',
    color: '12-bit full color',
    pitch: 'P6',
    price: 48990,
    image: 'assets/3x1-front.png',
    images: ['assets/3x1-front.png', 'assets/3x1-angle.png'],
    short: 'Outdoor-rated. 6000-nit brightness. IP65 enclosure.',
    inStock: true,
  },
  {
    id: 'beacon-50',
    sku: 'LMCEC05D15BP65H0',
    series: 'beacon',
    name: 'Beacon 50',
    size: '5 × 1.5 ft',
    resolution: '256 × 72',
    color: '12-bit full color',
    pitch: 'P6',
    price: 64990,
    image: 'assets/3x1-angle.png',
    images: ['assets/3x1-angle.png', 'assets/3x1-front.png'],
    short: 'Flagship outdoor display. Built to face the weather.',
    inStock: false,
    badge: 'Pre-order',
  },
];

function formatPrice(n) {
  return '₹' + n.toLocaleString('en-IN');
}

function getProduct(id) { return PRODUCTS.find(p => p.id === id); }
function getSeries(id) { return SERIES.find(s => s.id === id); }
function productsInSeries(id) { return PRODUCTS.filter(p => p.series === id); }

Object.assign(window, { SITE, SERIES, PRODUCTS, formatPrice, getProduct, getSeries, productsInSeries, waUrl, waGeneralEnquiry, waProductEnquiry, waCartEnquiry });
