// data.jsx — PsyFit sample data (deterministic, no random-per-load)

// ── Muscle groups ────────────────────────────────────────────
const MUSCLES = ['Chest', 'Back', 'Shoulders', 'Arms', 'Legs', 'Core'];

// ── Exercise library ─────────────────────────────────────────
const LIBRARY = [
  { id: 'bench',     name: 'Bench Press',            muscle: 'Chest',     gear: 'Barbell',   custom: false },
  { id: 'incdb',     name: 'Incline DB Press',       muscle: 'Chest',     gear: 'Dumbbell',  custom: false },
  { id: 'cablefly',  name: 'Cable Fly',              muscle: 'Chest',     gear: 'Cable',     custom: false },
  { id: 'pushup',    name: 'Push-Up',                muscle: 'Chest',     gear: 'Bodyweight',custom: false },
  { id: 'pullup',    name: 'Pull-Up',                muscle: 'Back',      gear: 'Bodyweight',custom: false },
  { id: 'row',       name: 'Barbell Row',            muscle: 'Back',      gear: 'Barbell',   custom: false },
  { id: 'latpull',   name: 'Lat Pulldown',           muscle: 'Back',      gear: 'Cable',     custom: false },
  { id: 'deadlift',  name: 'Deadlift',               muscle: 'Back',      gear: 'Barbell',   custom: false },
  { id: 'ohp',       name: 'Overhead Press',         muscle: 'Shoulders', gear: 'Barbell',   custom: false },
  { id: 'latraise',  name: 'Lateral Raise',          muscle: 'Shoulders', gear: 'Dumbbell',  custom: false },
  { id: 'facepull',  name: 'Face Pull',              muscle: 'Shoulders', gear: 'Cable',     custom: false },
  { id: 'curl',      name: 'Bicep Curl',             muscle: 'Arms',      gear: 'Dumbbell',  custom: false },
  { id: 'pushdown',  name: 'Tricep Pushdown',        muscle: 'Arms',      gear: 'Cable',     custom: false },
  { id: 'hammer',    name: 'Hammer Curl',            muscle: 'Arms',      gear: 'Dumbbell',  custom: false },
  { id: 'squat',     name: 'Back Squat',             muscle: 'Legs',      gear: 'Barbell',   custom: false },
  { id: 'legpress',  name: 'Leg Press',              muscle: 'Legs',      gear: 'Machine',   custom: false },
  { id: 'rdl',       name: 'Romanian Deadlift',      muscle: 'Legs',      gear: 'Barbell',   custom: false },
  { id: 'legcurl',   name: 'Leg Curl',               muscle: 'Legs',      gear: 'Machine',   custom: false },
  { id: 'calf',      name: 'Calf Raise',             muscle: 'Legs',      gear: 'Machine',   custom: false },
  { id: 'plank',     name: 'Plank',                  muscle: 'Core',      gear: 'Bodyweight',custom: false },
  { id: 'cablecrunch',name:'Cable Crunch',           muscle: 'Core',      gear: 'Cable',     custom: false },
  { id: 'hangleg',   name: 'Hanging Leg Raise',      muscle: 'Core',      gear: 'Bodyweight',custom: false },
];

// ── Today's workout plan ─────────────────────────────────────
const TODAY_PLAN = {
  title: 'Push Day',
  subtitle: 'Chest · Shoulders · Triceps',
  durationMin: 52,
  exercises: [
    { id: 'bench',    sets: [{ reps: 8, weight: 135, done: true }, { reps: 8, weight: 135, done: true }, { reps: 7, weight: 145, done: true }, { reps: 6, weight: 145, done: false }] },
    { id: 'incdb',    sets: [{ reps: 10, weight: 50, done: true }, { reps: 10, weight: 50, done: true }, { reps: 9, weight: 55, done: false }] },
    { id: 'ohp',      sets: [{ reps: 8, weight: 75, done: false }, { reps: 8, weight: 75, done: false }, { reps: 8, weight: 75, done: false }] },
    { id: 'cablefly', sets: [{ reps: 12, weight: 30, done: false }, { reps: 12, weight: 30, done: false }, { reps: 12, weight: 30, done: false }] },
    { id: 'pushdown', sets: [{ reps: 15, weight: 50, done: false }, { reps: 15, weight: 50, done: false }, { reps: 15, weight: 50, done: false }] },
  ],
};

// ── Weekly program split ─────────────────────────────────────
const WEEK_SPLIT = [
  { day: 'Mon', focus: 'Push',   muscles: 'Chest · Shoulders · Tris', rest: false },
  { day: 'Tue', focus: 'Pull',   muscles: 'Back · Biceps',            rest: false },
  { day: 'Wed', focus: 'Rest',   muscles: 'Recovery · Mobility',      rest: true },
  { day: 'Thu', focus: 'Legs',   muscles: 'Quads · Hams · Calves',    rest: false },
  { day: 'Fri', focus: 'Upper',  muscles: 'Chest · Back · Arms',      rest: false },
  { day: 'Sat', focus: 'Lower',  muscles: 'Glutes · Hams · Core',     rest: false },
  { day: 'Sun', focus: 'Rest',   muscles: 'Recovery · Walk',          rest: true },
];

// ── Chart data ───────────────────────────────────────────────
// Bench press estimated 1RM / working weight over 10 weeks (lbs)
const WEIGHT_SERIES = {
  bench:   [125, 130, 130, 135, 135, 140, 140, 145, 150, 155],
  squat:   [185, 185, 195, 205, 205, 215, 225, 225, 235, 245],
  deadlift:[225, 235, 245, 245, 260, 270, 275, 285, 295, 305],
  ohp:     [ 75,  75,  80,  80,  85,  85,  90,  90,  95,  95],
};
const SERIES_LABELS = ['W1','W2','W3','W4','W5','W6','W7','W8','W9','W10'];

// Total volume (lbs lifted) per last 8 sessions
const VOLUME_SERIES = [
  { label: 'May 12', volume: 14200 },
  { label: 'May 14', volume: 15800 },
  { label: 'May 17', volume: 13100 },
  { label: 'May 19', volume: 16400 },
  { label: 'May 22', volume: 15200 },
  { label: 'May 24', volume: 17800 },
  { label: 'May 26', volume: 16900 },
  { label: 'May 28', volume: 18600 },
];

// Reps completed per session (volume of reps)
const REPS_SERIES = [
  { label: 'May 12', reps: 128 },
  { label: 'May 14', reps: 142 },
  { label: 'May 17', reps: 118 },
  { label: 'May 19', reps: 156 },
  { label: 'May 22', reps: 134 },
  { label: 'May 24', reps: 168 },
  { label: 'May 26', reps: 152 },
  { label: 'May 28', reps: 174 },
];

// Streak heatmap — 12 weeks × 7 days, intensity 0..3 (0 = no workout)
// Built deterministically from a fixed pattern string.
const HEATMAP = (() => {
  // 84 values, recent at the end. 0 rest/missed, 1-3 workout intensity.
  const pat = '00203100210320012031002303100230230012032100230320012303100230320012303120023032';
  const arr = pat.split('').map(Number);
  while (arr.length < 84) arr.push(0);
  return arr.slice(0, 84);
})();

// ── Profile / stats ──────────────────────────────────────────
const PROFILE = {
  name: 'Alex Rivera',
  handle: '@alexlifts',
  memberSince: 'Jan 2026',
  level: 'Intermediate',
  stats: {
    workouts: 84,
    streak: 12,
    bestStreak: 23,
    totalVolume: 1240000,
    prs: 17,
  },
  prs: [
    { ex: 'Bench Press', value: 155, unit: 'lbs', when: '2d ago' },
    { ex: 'Deadlift',    value: 305, unit: 'lbs', when: '4d ago' },
    { ex: 'Back Squat',  value: 245, unit: 'lbs', when: '1w ago' },
  ],
};

// helper to find an exercise by id
function exById(id) { return LIBRARY.find(e => e.id === id) || { name: id, muscle: '', gear: '' }; }

Object.assign(window, {
  MUSCLES, LIBRARY, TODAY_PLAN, WEEK_SPLIT,
  WEIGHT_SERIES, SERIES_LABELS, VOLUME_SERIES, REPS_SERIES, HEATMAP,
  PROFILE, exById,
});
