const MLB_PARKS = {
  yankee_stadium: { name: 'Yankee Stadium', coords: [40.8296, -73.9262], team: 'NYY' },
  fenway_park: { name: 'Fenway Park', coords: [42.3467, -71.0972], team: 'BOS' },
  dodger_stadium: { name: 'Dodger Stadium', coords: [34.0739, -118.2400], team: 'LAD' },
  wrigley_field: { name: 'Wrigley Field', coords: [41.9484, -87.6553], team: 'CHC' },
  oracle_park: { name: 'Oracle Park', coords: [37.7786, -122.3893], team: 'SF' },
  coors_field: { name: 'Coors Field', coords: [39.7559, -104.9942], team: 'COL' },
  petco_park: { name: 'Petco Park', coords: [32.7076, -117.1570], team: 'SD' },
  camden_yards: { name: 'Oriole Park at Camden Yards', coords: [39.2839, -76.6218], team: 'BAL' },
  comerica_park: { name: 'Comerica Park', coords: [42.3390, -83.0485], team: 'DET' },
  great_american: { name: 'Great American Ball Park', coords: [39.0976, -84.5082], team: 'CIN' },
  truist_park: { name: 'Truist Park', coords: [33.8908, -84.4678], team: 'ATL' },
  chase_field: { name: 'Chase Field', coords: [33.4453, -112.0667], team: 'ARI' },
  citi_field: { name: 'Citi Field', coords: [40.7571, -73.8458], team: 'NYM' },
  citizens_bank: { name: 'Citizens Bank Park', coords: [39.9061, -75.1665], team: 'PHI' },
  pnc_park: { name: 'PNC Park', coords: [40.4469, -80.0057], team: 'PIT' },
  busch_stadium: { name: 'Busch Stadium', coords: [38.6226, -90.1928], team: 'STL' },
  american_family: { name: 'American Family Field', coords: [43.0280, -87.9712], team: 'MIL' },
  progressive_field: { name: 'Progressive Field', coords: [41.4962, -81.6852], team: 'CLE' },
  minute_maid: { name: 'Minute Maid Park', coords: [29.7573, -95.3555], team: 'HOU' },
  globe_life: { name: 'Globe Life Field', coords: [32.7473, -97.0820], team: 'TEX' },
  angel_stadium: { name: 'Angel Stadium', coords: [33.8003, -117.8827], team: 'LAA' },
  t_mobile_park: { name: 'T-Mobile Park', coords: [47.5914, -122.3325], team: 'SEA' },
  target_field: { name: 'Target Field', coords: [44.9817, -93.2778], team: 'MIN' },
  kauffman_stadium: { name: 'Kauffman Stadium', coords: [39.0517, -94.4803], team: 'KC' },
  guaranteed_rate: { name: 'Guaranteed Rate Field', coords: [41.8300, -87.6339], team: 'CWS' },
  loanDepot_park: { name: 'loanDepot park', coords: [25.7781, -80.2197], team: 'MIA' },
  nationals_park: { name: 'Nationals Park', coords: [38.8730, -77.0074], team: 'WSH' },
  tropicana_field: { name: 'Tropicana Field', coords: [27.7683, -82.6534], team: 'TB' },
  oakland_coliseum: { name: 'Oakland Coliseum', coords: [37.7516, -122.2005], team: 'OAK' },
  rogers_centre: { name: 'Rogers Centre', coords: [43.6414, -79.3894], team: 'TOR' },
};

function getParkByTeam(teamAbbrev) {
  const entries = Object.entries(MLB_PARKS);
  for (const [key, park] of entries) {
    if (park.team === teamAbbrev) {
      return { key, ...park };
    }
  }
  return null;
}

module.exports = { MLB_PARKS, getParkByTeam };
