export function calculateRocketScore(row) {
  let score = 0;

  // Premium tier (0-3 points)
  if (row.premium_num >= 2000000) score += 3.0;
  else if (row.premium_num >= 800000) score += 2.0;
  else if (row.premium_num >= 200000) score += 1.0;

  // Net premium imbalance (-1.5 to +1.5 points)
  const totalPrem = row.bull_total + row.bear_total;
  if (totalPrem > 0) {
    score += 1.5 * ((row.bull_total - row.bear_total) / totalPrem);
  }

  // Vol > OI (1.2 points)
  if (row.vol_num > row.oi_num) score += 1.2;

  // Session weight (0-1 point)
  const sessionWeights = { RTH: 1.0, POST: 0.5, PRE: 0.3, OFF: 0 };
  score += sessionWeights[row.session_bucket] || 0;

  // Catalyst flag (1 point)
  if (row.near_alert_type) score += 1.0;

  // OTM bias (0.8 points)
  const isOTM = 
    (row.cp_norm === 'CALL' && row.strike_num > row.spot_num) ||
    (row.cp_norm === 'PUT' && row.strike_num < row.spot_num);
  if (isOTM) score += 0.8;

  // Tape alignment (0.5 points)
  if (row.tape_alignment === 1) score += 0.5;

  return parseFloat(score.toFixed(2));
}
