// Sample resume content with issues tagged
const RESUME = {
  name: 'Jordan Rivera',
  title: 'Senior Product Designer',
  contact: ['jordan.r@mail.com', '(415) 555-0142', 'linkedin.com/in/jrivera', 'San Francisco, CA'],
  summary: {
    text: 'Results-oriented designer with a proven track record of leveraging synergies to deliver impactful experiences. Team player passionate about cutting-edge design.',
    issues: [
      { word: 'Results-oriented', type: 'vague', id: 'i1' },
      { word: 'leveraging synergies', type: 'vague', id: 'i2' },
      { word: 'cutting-edge', type: 'vague', id: 'i3' },
    ],
  },
  experience: [
    {
      role: 'Product Designer',
      company: 'Lumen Labs',
      dates: 'Mar 2022 — Present',
      bullets: [
        { text: 'Was responsible for redesigning the onboarding flow, which was used by many users.', issues: [
          { word: 'Was responsible for', type: 'passive', id: 'i4' },
          { word: 'many users', type: 'metric', id: 'i5' },
        ]},
        { text: 'Helped the team ship a new dashboard that improved things across the board.', issues: [
          { word: 'Helped', type: 'verb', id: 'i6' },
          { word: 'improved things across the board', type: 'vague', id: 'i7' },
        ]},
        { text: 'Led a cross-functional design system initiative, reducing component inconsistencies by 64% and cutting engineering handoff time from 3 days to 6 hours.', issues: [] },
      ],
    },
    {
      role: 'UX Designer',
      company: 'Nimbus Co.',
      dates: 'Jun 2020 — Feb 2022',
      bullets: [
        { text: 'Worked on various projects and collaborate with stakeholders to drive outcomes.', issues: [
          { word: 'Worked on', type: 'verb', id: 'i8' },
          { word: 'various projects', type: 'vague', id: 'i9' },
          { word: 'collaborate', type: 'tense', id: 'i10' },
        ]},
        { text: 'Conducted 23 user interviews across 4 markets, synthesizing findings that shaped the Q3 roadmap.', issues: [] },
        { text: 'A checkout redesign was launched by me, which reduced cart abandonment.', issues: [
          { word: 'A checkout redesign was launched by me', type: 'passive', id: 'i11' },
          { word: 'reduced cart abandonment', type: 'metric', id: 'i12' },
        ]},
      ],
    },
  ],
  education: { school: 'UC Berkeley', degree: 'B.A. Cognitive Science, 2020' },
  missingSections: ['Skills', 'Technical Proficiencies'],
};

// Issue type metadata
const ISSUE_META = {
  verb:    { label: 'Weak action verb',       color: '#ff8a7a', cls: 'hl-verb',    icon: '⚡' },
  metric:  { label: 'Missing metrics',        color: '#e5c71a', cls: 'hl-metric',  icon: '#' },
  tense:   { label: 'Inconsistent tense',     color: '#4dd6ff', cls: 'hl-tense',   icon: '⏱' },
  passive: { label: 'Passive voice',          color: '#8a5cf6', cls: 'hl-passive', icon: '↔' },
  grammar: { label: 'Grammar',                color: '#ff4db8', cls: 'hl-grammar', icon: 'Aa' },
  vague:   { label: 'Vague / buzzword',       color: '#5ac77f', cls: 'hl-vague',   icon: '?' },
  missing: { label: 'Missing section',        color: '#ff4db8', cls: '',           icon: '+' },
  length:  { label: 'Bullet length',          color: '#ff8a7a', cls: '',           icon: '⇔' },
};

// Fix suggestions per issue id
const FIXES = {
  i1:  { from: 'Results-oriented', to: 'Shipping-focused', reason: 'Specific and active instead of corporate-speak.' },
  i2:  { from: 'leveraging synergies', to: 'partnering with engineering and research', reason: 'Real verbs beat buzzwords.' },
  i3:  { from: 'cutting-edge', to: 'accessible, performant', reason: 'Describes the work, not the hype.' },
  i4:  { from: 'Was responsible for', to: 'Redesigned', reason: 'Active voice. Own it.' },
  i5:  { from: 'many users', to: '2.3M monthly users', reason: 'Numbers make it real.' },
  i6:  { from: 'Helped', to: 'Shipped', reason: '"Helped" hides your contribution.' },
  i7:  { from: 'improved things across the board', to: 'lifted daily active usage by 22%', reason: 'Specific metric, visible impact.' },
  i8:  { from: 'Worked on', to: 'Led design for', reason: 'Shows ownership.' },
  i9:  { from: 'various projects', to: '3 enterprise product launches', reason: 'Quantify the scope.' },
  i10: { from: 'collaborate', to: 'collaborated', reason: 'Keep past tense for prior roles.' },
  i11: { from: 'A checkout redesign was launched by me', to: 'Launched a checkout redesign', reason: 'Active voice. You did it.' },
  i12: { from: 'reduced cart abandonment', to: 'cutting cart abandonment by 18% ($1.2M ARR)', reason: 'Quantify the win.' },
};

// Flat list of all issues for count
function allIssues() {
  const list = [];
  RESUME.summary.issues.forEach(i => list.push({ ...i, section: 'Summary' }));
  RESUME.experience.forEach(exp => {
    exp.bullets.forEach((b, bi) => {
      b.issues.forEach(i => list.push({ ...i, section: `${exp.company} · bullet ${bi+1}` }));
    });
  });
  RESUME.missingSections.forEach((s, i) => list.push({ id: `m${i}`, type: 'missing', word: s, section: 'Structure' }));
  return list;
}

window.RESUME = RESUME;
window.ISSUE_META = ISSUE_META;
window.FIXES = FIXES;
window.allIssues = allIssues;
