import type {
  EvidenceStatus,
  GhostNoteClass,
  NotePriority,
  NoteType,
  ResearchStage,
  WorkspaceViewKind,
} from '../../../types/research';

export const NOTE_TYPE_LABELS: Record<NoteType, string> = {
  fact: 'Fact',
  quote: 'Quote',
  management_signal: 'Mgmt Signal',
  claim: 'Claim',
  thesis: 'Thesis',
  sub_thesis: 'Sub-thesis',
  risk: 'Risk',
  catalyst: 'Catalyst',
  valuation_point: 'Valuation',
  scenario_assumption: 'Assumption',
  industry_observation: 'Industry',
  competitor_comparison: 'Competitor',
  question: 'Question',
  contradiction: 'Contradiction',
  uncertainty: 'Uncertainty',
  follow_up_task: 'Follow-up',
  source_reference: 'Source',
  event_takeaway: 'Event',
  channel_check: 'Channel Check',
  mosaic_insight: 'Mosaic',
};

export const NOTE_TYPE_ACCENTS: Record<NoteType, string> = {
  fact: 'var(--research-accent-evidence)',
  quote: '#9cc9f6',
  management_signal: '#f4bf75',
  claim: '#e3cf8d',
  thesis: 'var(--research-accent-thesis)',
  sub_thesis: '#93b8ff',
  risk: 'var(--research-accent-risk)',
  catalyst: 'var(--research-accent-catalyst)',
  valuation_point: '#72d8c7',
  scenario_assumption: '#d2b6ff',
  industry_observation: '#7fc0ff',
  competitor_comparison: '#7ac7f4',
  question: '#7fb4ff',
  contradiction: '#ff8b8b',
  uncertainty: '#9facc4',
  follow_up_task: '#f4bf75',
  source_reference: '#7f92a9',
  event_takeaway: '#91f5cf',
  channel_check: '#ffb176',
  mosaic_insight: 'var(--research-accent-ghost)',
};

export const PRIORITY_LABELS: Record<NotePriority, string> = {
  low: 'Low',
  normal: 'Normal',
  high: 'High',
  critical: 'Critical',
};

export const EVIDENCE_LABELS: Record<EvidenceStatus, string> = {
  unsourced: 'Unsourced',
  source_linked: 'Source linked',
  quoted: 'Quoted',
  corroborated: 'Corroborated',
  inferred: 'Inferred',
  contradicted: 'Contradicted',
  stale: 'Stale',
  superseded: 'Superseded',
};

export const STAGE_LABELS: Record<ResearchStage, string> = {
  capture: 'Capture',
  organize: 'Organize',
  thesis: 'Thesis',
  drafting: 'Drafting',
  monitor: 'Monitor',
};

export const VIEW_LABELS: Record<WorkspaceViewKind, string> = {
  canvas: 'Canvas',
  kanban: 'By Type',
  graph: 'Graph',
  thesis_builder: 'Thesis',
  memo_drafting: 'Memo',
  evidence_trace: 'Evidence',
  catalyst_risk_map: 'Catalyst / Risk',
  timeline: 'Timeline',
  model: 'Model',
};

export const GHOST_CLASS_LABELS: Record<GhostNoteClass, string> = {
  candidate_thesis: 'Candidate Thesis',
  candidate_risk: 'Candidate Risk',
  candidate_catalyst: 'Candidate Catalyst',
  missing_evidence_prompt: 'Missing Evidence',
  contradiction_alert: 'Contradiction',
  valuation_bridge: 'Valuation Bridge',
  scenario_implication: 'Scenario Implication',
  memo_outline_suggestion: 'Memo Outline',
  claim_support_gap: 'Claim Support Gap',
  claim_pressure_test: 'Pressure Test',
  thesis_dependency_gap: 'Thesis Dependency',
  contradiction_resolution: 'Contradiction Resolution',
  evidence_quality_warning: 'Evidence Quality',
  stale_support_warning: 'Stale Support',
  numerical_claim_verification: 'Numerical Verification',
  thesis_synthesis_candidate: 'Thesis Synthesis',
  model_assumption_challenge: 'Model Assumption',
  valuation_sensitivity_alert: 'Valuation Sensitivity',
};

export const formatConfidence = (confidence: number) =>
  `${Math.round(confidence * 100)}%`;
