/* ============================================================
   Session 57 (Phase 0) — honest per-sport empty-slate copy (spec §6).

   A sport with zero games must say WHY instead of showing a fixture game or
   passive "waiting" language. Month-aware: an off-season sport names its
   return window; an in-season sport calls it an off-day. CommonJS so both the
   .tsx surfaces (allowJs) and the plain-JS Jest suite can load it.
   ============================================================ */

// Off-season months per sport (0-indexed). Deliberately conservative: only
// months where the league is CERTAINLY dark, so an early/late season edge day
// reads as an off-day rather than falsely claiming the league is done.
const OFF_SEASON = {
  nba: { months: [6, 7, 8], returns: 'October' },        // Jul–Sep
  wnba: { months: [10, 11, 0, 1, 2, 3], returns: 'May' }, // Nov–Apr
  mlb: { months: [11, 0, 1], returns: 'spring' },         // Dec–Feb
};

const LABEL = { nba: 'NBA', wnba: 'WNBA', mlb: 'MLB', soccer: 'Soccer' };

/**
 * Copy for an empty slate. `sport` is lowercase ('nba'|'wnba'|'mlb'|'soccer'
 * |'all'); anything else falls back to the generic line.
 * Returns { title, body }.
 */
function emptyStateCopy(sport, date = new Date()) {
  const sp = String(sport || '').toLowerCase();
  const month = date.getMonth();

  const off = OFF_SEASON[sp];
  if (off && off.months.includes(month)) {
    return {
      title: `${LABEL[sp]} returns in ${off.returns}.`,
      body: 'The offseason board is dark. The model is running the live slates in the meantime.',
    };
  }
  if (LABEL[sp]) {
    return {
      title: `No ${LABEL[sp]} games today.`,
      body: 'Off-day. The board refills with the next slate.',
    };
  }
  return {
    title: 'No games on the board today.',
    body: 'The board refills with the next slate.',
  };
}

module.exports = { emptyStateCopy, OFF_SEASON };
