// Mock market data for the landing page widgets.

const HAY_GRADES = [
  { sym: 'ALF.PRM',  name: 'Alfalfa · Premium',     price: 312.40, chg:  +1.85, vol: '14.2k' },
  { sym: 'ALF.SUP',  name: 'Alfalfa · Supreme',     price: 348.10, chg:  +2.40, vol: '8.6k'  },
  { sym: 'ALF.GD1',  name: 'Alfalfa · Good',        price: 268.75, chg:  -0.95, vol: '21.0k' },
  { sym: 'GRS.PRM',  name: 'Grass · Premium',       price: 245.20, chg:  +0.60, vol: '11.4k' },
  { sym: 'TIM.1ST',  name: 'Timothy · 1st cut',     price: 289.00, chg:  +3.10, vol: '4.1k'  },
  { sym: 'TIM.2ND',  name: 'Timothy · 2nd cut',     price: 305.50, chg:  +1.25, vol: '3.8k'  },
  { sym: 'ORC.PRM',  name: 'Orchard · Premium',     price: 272.90, chg:  -1.40, vol: '6.9k'  },
  { sym: 'BMD.MIX',  name: 'Bermuda Mix',           price: 198.60, chg:  +0.20, vol: '9.7k'  },
  { sym: 'STR.WHT',  name: 'Straw · Wheat',         price: 142.10, chg:  -0.30, vol: '2.4k'  },
  { sym: 'OAT.HAY',  name: 'Oat Hay',               price: 178.40, chg:  +0.85, vol: '1.9k'  },
];

const REGIONS = [
  // x,y are percent on a stylized US footprint
  { code: 'CA',  name: 'California',  x: 8,  y: 56, price: 328, chg: +2.1, demand: 0.92 },
  { code: 'OR',  name: 'Oregon',      x: 12, y: 28, price: 286, chg: +0.9, demand: 0.71 },
  { code: 'WA',  name: 'Washington',  x: 14, y: 18, price: 294, chg: +1.4, demand: 0.78 },
  { code: 'ID',  name: 'Idaho',       x: 22, y: 32, price: 252, chg: -0.4, demand: 0.62 },
  { code: 'MT',  name: 'Montana',     x: 30, y: 22, price: 234, chg: -0.8, demand: 0.45 },
  { code: 'WY',  name: 'Wyoming',     x: 34, y: 38, price: 241, chg: +0.2, demand: 0.51 },
  { code: 'CO',  name: 'Colorado',    x: 38, y: 50, price: 268, chg: +1.0, demand: 0.66 },
  { code: 'NM',  name: 'New Mexico',  x: 38, y: 66, price: 292, chg: +1.8, demand: 0.74 },
  { code: 'TX',  name: 'Texas',       x: 48, y: 76, price: 278, chg: +0.6, demand: 0.81 },
  { code: 'OK',  name: 'Oklahoma',    x: 50, y: 62, price: 245, chg: -0.3, demand: 0.58 },
  { code: 'KS',  name: 'Kansas',      x: 50, y: 52, price: 232, chg: -0.5, demand: 0.49 },
  { code: 'NE',  name: 'Nebraska',    x: 50, y: 42, price: 228, chg: +0.1, demand: 0.55 },
  { code: 'SD',  name: 'South Dakota',x: 48, y: 32, price: 219, chg: -1.2, demand: 0.39 },
  { code: 'ND',  name: 'North Dakota',x: 48, y: 22, price: 215, chg: -0.7, demand: 0.36 },
  { code: 'MN',  name: 'Minnesota',   x: 58, y: 28, price: 248, chg: +0.4, demand: 0.61 },
  { code: 'IA',  name: 'Iowa',        x: 60, y: 40, price: 256, chg: +0.8, demand: 0.69 },
  { code: 'WI',  name: 'Wisconsin',   x: 64, y: 30, price: 274, chg: +1.1, demand: 0.76 },
  { code: 'MI',  name: 'Michigan',    x: 72, y: 32, price: 281, chg: +0.7, demand: 0.72 },
  { code: 'NY',  name: 'New York',    x: 84, y: 30, price: 312, chg: +1.6, demand: 0.84 },
  { code: 'PA',  name: 'Pennsylvania',x: 82, y: 38, price: 298, chg: +1.2, demand: 0.79 },
  { code: 'KY',  name: 'Kentucky',    x: 70, y: 50, price: 264, chg: +0.5, demand: 0.65 },
  { code: 'TN',  name: 'Tennessee',   x: 68, y: 58, price: 258, chg: +0.3, demand: 0.62 },
  { code: 'GA',  name: 'Georgia',     x: 74, y: 70, price: 286, chg: +1.5, demand: 0.77 },
  { code: 'FL',  name: 'Florida',     x: 78, y: 84, price: 308, chg: +2.3, demand: 0.88 },
];

// 90-day spot price series (synthetic but coherent)
function genSeries(seed, base, vol) {
  const arr = [];
  let v = base;
  let r = seed * 9301 + 49297;
  for (let i = 0; i < 90; i++) {
    r = (r * 9301 + 49297) % 233280;
    const noise = (r / 233280 - 0.5) * vol;
    const trend = Math.sin(i / 14) * vol * 0.4 + i * 0.15;
    v = base + trend + noise * 4;
    arr.push(v);
  }
  return arr;
}

const SERIES = {
  'ALF.PRM': genSeries(3, 295, 6),
  'ALF.SUP': genSeries(5, 330, 7),
  'GRS.PRM': genSeries(8, 235, 4),
  'TIM.1ST': genSeries(11, 275, 5),
};

window.HAYSCOUT_DATA = { HAY_GRADES, REGIONS, SERIES };
