import axios from 'axios';
import { lakesConfig } from './scripts/lakesConfig';

async function testHistory() {
  const lipno = lakesConfig.find(l => l.id.startsWith('VLL1'));
  if (!lipno) return;
  const url = `https://api.open-meteo.com/v1/forecast?latitude=${lipno.coords[0]}&longitude=${lipno.coords[1]}&past_days=7&hourly=temperature_2m,precipitation&timezone=GMT`;
  console.log('Fetching from:', url);
  try {
    const res = await axios.get(url);
    const hourly = res.data.hourly;
    console.log(`Received ${hourly.time.length} hourly records.`);
    console.log('Sample record at index 100:');
    console.log('Time:', hourly.time[100]);
    console.log('Temp:', hourly.temperature_2m[100]);
  } catch (e) {
    console.error(e.message);
  }
}

testHistory();
