/* cflow-data.jsx — mock data for Campaign Flow v2 */
/* global window */

// Status order matching the plan
const CF_STATUSES = ['draft', 'recruiting', 'in_progress', 'completed', 'cancelled', 'archived'];

// Valid transitions per plan (campaign-status-transitions.ts)
const CF_TRANSITIONS = {
  draft:        ['recruiting', 'cancelled'],
  recruiting:   ['in_progress', 'cancelled'],
  in_progress:  ['completed', 'cancelled'],
  completed:    ['archived'],
  cancelled:    ['archived'],
  archived:     [],
};

const CF_STATUS_LABEL = {
  draft: 'Draft',
  recruiting: 'Recruiting',
  in_progress: 'In progress',
  completed: 'Completed',
  cancelled: 'Cancelled',
  archived: 'Archived',
};

// Mock campaigns (live list)
const CF_CAMPAIGNS = [
  {
    id: 'C-2419', code: 'VC',
    name: 'Vitamin C Skin Glow', brand: 'Aurora Beauty',
    status: 'recruiting',
    color: 'var(--cyan)',
    platforms: ['tiktok', 'instagram'],
    budget: 15000, applied: 24, approved: 6,
    progress: 18, // %
    start: 'May 20', end: 'Jun 17', due: 'Apply by May 17',
  },
  {
    id: 'C-2420', code: 'WL',
    name: 'Wellness Launch Q2', brand: 'Verde Co.',
    status: 'in_progress',
    color: 'var(--mint-deep)',
    platforms: ['tiktok', 'youtube'],
    budget: 28000, applied: 41, approved: 8,
    progress: 62,
    start: 'Apr 28', end: 'May 26', due: '2 deliverables late',
  },
  {
    id: 'C-2421', code: 'BR',
    name: 'Beach Ready · Summer', brand: 'Aurora Beauty',
    status: 'draft',
    color: 'var(--lavender-deep)',
    platforms: ['tiktok', 'instagram'],
    budget: 8000, applied: 0, approved: 0,
    progress: 0,
    start: 'TBC', end: 'TBC', due: 'Auto-saved 12s ago',
  },
  {
    id: 'C-2418', code: 'SC',
    name: 'Sneaker Drop · Q1', brand: 'Pace',
    status: 'completed',
    color: 'var(--indigo)',
    platforms: ['tiktok', 'instagram'],
    budget: 22000, applied: 38, approved: 7,
    progress: 100,
    start: 'Mar 10', end: 'Apr 7', due: 'Report ready',
  },
  {
    id: 'C-2417', code: 'AC',
    name: 'Acne Spot Cream · Launch', brand: 'Aurora Beauty',
    status: 'in_progress',
    color: 'var(--pink-hot)',
    platforms: ['tiktok'],
    budget: 11000, applied: 19, approved: 5,
    progress: 38,
    start: 'May 5', end: 'Jun 1', due: '12 days left',
  },
  {
    id: 'C-2416', code: 'CF',
    name: 'Cafe Affiliate · Hanoi', brand: 'Drip Hanoi',
    status: 'recruiting',
    color: 'var(--yellow-deep)',
    platforms: ['instagram'],
    budget: 6500, applied: 11, approved: 3,
    progress: 5,
    start: 'May 25', end: 'Jul 8', due: 'Apply by May 22',
  },
];

// Applications for detail view
const CF_APPLICATIONS = [
  {
    id: 'A-91', name: 'Linh Châu', handle: '@linhchau',
    platform: 'tiktok', followers: '482K', er: 6.2, match: 94,
    rate: 3500, status: 'pending', note: 'I have a vitamin C series ready — can ship in 5 days. Open to bundle 3 videos.',
    rebookCount: 2,
  },
  {
    id: 'A-92', name: 'Hà Giang', handle: '@hagiang',
    platform: 'tiktok', followers: '320K', er: 7.1, match: 84,
    rate: 2200, status: 'pending', note: 'Clean-beauty angle; happy to do unboxing + 14-day review.',
    rebookCount: 0,
  },
  {
    id: 'A-93', name: 'Diệu Linh', handle: '@dieulinh.skin',
    platform: 'tiktok', followers: '95K', er: 8.4, match: 72,
    rate: 1400, status: 'accepted', note: 'Accepted · contract sent · awaiting first draft.',
    rebookCount: 0,
  },
  {
    id: 'A-94', name: 'Phương Anh', handle: '@phuonganh.beauty',
    platform: 'youtube', followers: '210K', er: 4.4, match: 78,
    rate: 4000, status: 'rejected', note: 'Rejected · 18% audience flagged as suspicious.',
    rebookCount: 0,
  },
];

// Milestones (derived from campaign dates per Phase 04)
const CF_MILESTONES = [
  { id: 'kickoff', label: 'Kickoff',         date: 'May 5',  state: 'done' },
  { id: 'open',    label: 'Open recruiting', date: 'May 8',  state: 'done' },
  { id: 'pick',    label: 'Pick shortlist',  date: 'May 12', state: 'done' },
  { id: 'draft',   label: 'Drafts due',      date: 'May 18', state: 'late',   late: '2 drafts late' },
  { id: 'live',    label: 'Go live',         date: 'May 22', state: 'active' },
  { id: 'review',  label: 'Performance review', date: 'May 30', state: 'todo' },
  { id: 'wrap',    label: 'Wrap & report',   date: 'Jun 1',  state: 'todo' },
];

// Consolidation rationale
const CF_OLD_FLOW = [
  { l: 'Create Brief',                          danger: false, note: 'wizard #1' },
  { l: 'Manage Briefs (list, statuses)',        danger: true,  note: 'parallel screen' },
  { l: 'Brief detail · AI Shortlist',           danger: false, note: '' },
  { l: 'Create Campaign · pick Brief',          danger: true,  note: 'wizard #2 — duplicates fields' },
  { l: 'Manage Campaigns (list, statuses)',     danger: true,  note: 'parallel screen' },
  { l: 'Campaign detail',                        danger: false, note: '' },
  { l: 'Reports (per campaign)',                 danger: false, note: '' },
];

const CF_NEW_FLOW = [
  { l: 'Create Campaign (1 wizard · 4 steps)', danger: false, note: 'Brief content baked in' },
  { l: 'Campaigns dashboard (status filters)',  danger: false, note: '' },
  { l: 'Campaign detail → status dropdown',      danger: false, note: 'recruiting · in_progress · …' },
  { l: 'Milestone timeline + applications',     danger: false, note: 'inline approve / reject' },
  { l: 'Reports (linked to same campaign)',      danger: false, note: '' },
];

const CF_CHANGES = [
  { from: 'Two parallel entities: Brief + Campaign', to: 'One entity: Campaign with a status field' },
  { from: 'Two wizards (Brief 4 steps + Campaign 3 steps)', to: 'One 4-step wizard with auto-save · resume drafts' },
  { from: '“Publish” / “Close” brief actions', to: 'Status dropdown: draft → recruiting → in_progress → completed → archived' },
  { from: 'Shortlist + Applications in separate pages', to: 'Applications inline on Campaign detail · approve / reject without modal' },
  { from: 'Brand creates Brief, then Creator browses Briefs', to: 'Creator browses Campaigns in “recruiting” · one-click apply or proposal drawer' },
  { from: 'No timeline — only start/end dates', to: 'Auto-derived milestone timeline · late deliverable badge' },
];

Object.assign(window, {
  CF_STATUSES, CF_TRANSITIONS, CF_STATUS_LABEL,
  CF_CAMPAIGNS, CF_APPLICATIONS, CF_MILESTONES,
  CF_OLD_FLOW, CF_NEW_FLOW, CF_CHANGES,
});
