/**
 * 展示标签 + tone 元数据 — 后端 enum 跟前端 UI 之间的桥。
 *
 * 单一真理源,前后端共用。新加 enum 值时在这里加一行 label,前端自动拿到。
 */
import { PersonaFeatureKey, PlanScenario } from './enums';

// ─────────────────────────────────────────────────────────
// Tone — UI 色板键(对应前端 Tailwind 色板 teal/indigo/...)
// ─────────────────────────────────────────────────────────

export type Tone =
  | 'teal'
  | 'indigo'
  | 'emerald'
  | 'amber'
  | 'rose'
  | 'sky'
  | 'violet'
  | 'slate';

// ─────────────────────────────────────────────────────────
// PlanScenario 中文展示标签
// ─────────────────────────────────────────────────────────

export const PLAN_SCENARIO_LABEL: Record<string, string> = {
  [PlanScenario.TREATMENT_AFTERCARE_RECALL]: '疗效保障',
  [PlanScenario.TREATMENT_INITIATION_RECALL]: '启治召回',
  treatment_chain_disruption_recall: '链中断', // 待业务拍板,暂未入 enum
  missed_diagnosis_recall: '漏诊召回', // W6+ 影像 AI
};

export const planScenarioLabel = (key: string): string =>
  PLAN_SCENARIO_LABEL[key] ?? key;

// ─────────────────────────────────────────────────────────
// PersonaFeatureKey 中文展示 + UI tone
// ─────────────────────────────────────────────────────────

export const PERSONA_FEATURE_META: Record<string, { label: string; tone: Tone }> = {
  [PersonaFeatureKey.VALUE]: { label: '患者价值', tone: 'indigo' },
  [PersonaFeatureKey.TREATMENT_CHAIN_STATUS]: { label: '治疗链状态', tone: 'amber' },
  [PersonaFeatureKey.RECALL_RISK]: { label: '流失风险', tone: 'emerald' },
  [PersonaFeatureKey.DO_NOT_CONTACT_STATUS]: { label: '不打扰状态', tone: 'slate' },
  [PersonaFeatureKey.ENTITLEMENT_STATUS]: { label: '权益身份', tone: 'indigo' },
  [PersonaFeatureKey.INCOMPLETE_TREATMENT]: { label: '未完成治疗', tone: 'amber' },
  [PersonaFeatureKey.RECOMMENDED_ROLE]: { label: '推荐角色', tone: 'teal' },
  [PersonaFeatureKey.REFERRAL_RELATION]: { label: '转介绍关系', tone: 'sky' },
  [PersonaFeatureKey.DOCTOR_RELATION]: { label: '主治医患', tone: 'slate' },
  [PersonaFeatureKey.COMMUNICATION_PREFERENCE]: { label: '沟通偏好', tone: 'sky' },
  [PersonaFeatureKey.CUSTOMER_EXPERIENCE_RISK]: { label: '客户体验风险', tone: 'rose' },
  [PersonaFeatureKey.TREATMENT_INTENT]: { label: '治疗意向', tone: 'teal' },
  [PersonaFeatureKey.FAMILY_SOCIAL_RELATION]: { label: '家庭/社交关系', tone: 'slate' },
  [PersonaFeatureKey.ENGAGEMENT]: { label: '触达活跃度', tone: 'sky' },
  [PersonaFeatureKey.PATIENT_SEGMENT]: { label: '人群细分', tone: 'slate' },
  [PersonaFeatureKey.COMPLAINT_HISTORY]: { label: '投诉历史', tone: 'rose' },
  [PersonaFeatureKey.POTENTIAL_TREATMENT]: { label: '待治疗机会', tone: 'amber' },
  [PersonaFeatureKey.COOPERATION_ATTITUDE]: { label: '配合态度', tone: 'emerald' },
  [PersonaFeatureKey.PRIMARY_CONTACT_RELATION]: { label: '主要联系人', tone: 'slate' },
};

export const personaFeatureMeta = (key: string): { label: string; tone: Tone } =>
  PERSONA_FEATURE_META[key] ?? { label: key, tone: 'slate' };
