/**
 * 消息场景弹层元信息：标题 / 色调 / 尺寸（非 Vben，消息专用）
 */
export type NoticeSceneTone =
  | 'default'
  | 'vip'
  | 'danger'
  | 'money'
  | 'report'
  | 'audit'
  | 'invoice';

export type NoticeSceneSize = 'md' | 'lg' | 'xl';

export interface NoticeSceneMeta {
  title: string;
  kicker: string;
  tone: NoticeSceneTone;
  size: NoticeSceneSize;
  /** true：内容自带头图，外壳只留关闭钮 */
  bareHeader?: boolean;
}

const DEFAULT_META: NoticeSceneMeta = {
  title: '消息详情',
  kicker: 'NOTICE',
  tone: 'default',
  size: 'md',
};

export const NOTICE_SCENE_META: Record<string, NoticeSceneMeta> = {
  vip: {
    title: 'VIP 通知',
    kicker: 'MEMBERSHIP',
    tone: 'vip',
    size: 'lg',
    bareHeader: true,
  },
  period_report: {
    title: '运营总结',
    kicker: 'REPORT',
    tone: 'report',
    size: 'lg',
  },
  withdraw_audit: {
    title: '提现待审',
    kicker: 'FINANCE',
    tone: 'money',
    size: 'md',
  },
  invoice_todo: {
    title: '开票待办',
    kicker: 'INVOICE',
    tone: 'invoice',
    size: 'md',
  },
  queue_failure: {
    title: '队列失败',
    kicker: 'QUEUE',
    tone: 'danger',
    size: 'lg',
  },
  warehouse_product_audit: {
    title: '仓品待审',
    kicker: 'WAREHOUSE',
    tone: 'audit',
    size: 'lg',
  },
  store_input_audit: {
    title: '门店录入待审',
    kicker: 'STORE',
    tone: 'audit',
    size: 'xl',
  },
  doctor_input_audit: {
    title: '医生预填待审',
    kicker: 'DOCTOR',
    tone: 'audit',
    size: 'xl',
  },
  price_change: {
    title: '药价变更',
    kicker: 'PRICE',
    tone: 'report',
    size: 'md',
  },
  system: {
    title: '系统通知',
    kicker: 'SYSTEM',
    tone: 'default',
    size: 'md',
  },
  broadcast: {
    title: '系统公告',
    kicker: 'BROADCAST',
    tone: 'default',
    size: 'md',
  },
  prescription_audit: {
    title: '处方审核',
    kicker: 'RX',
    tone: 'audit',
    size: 'md',
  },
};

export function resolveNoticeSceneMeta(typeCode?: string): NoticeSceneMeta {
  const code = String(typeCode || '').trim();
  return NOTICE_SCENE_META[code] || {
    ...DEFAULT_META,
    title: DEFAULT_META.title,
  };
}
