import type { LedgerEntry, MemoryLifecycleState } from '@/lib/types/lifecycle'
import type { MemoryLedgerAction } from '@/lib/types/lifecycle'

export const stateLabel: Record<MemoryLifecycleState, string> = {
  draft: '草稿',
  candidate: '候选',
  accepted: '已采纳',
  canonical: '已固化',
  archived: '已归档',
}

export const actionLabel: Record<MemoryLedgerAction, string> = {
  record_manual: '手动记录',
  propose_ai: 'AI 提议',
  submit_proposal: '提交提议',
  accept: '采纳',
  promote_to_canonical: '晋升固化',
  archive: '归档',
}

export const stateVariant: Record<
  MemoryLifecycleState,
  'default' | 'secondary' | 'destructive' | 'muted' | 'outline'
> = {
  draft: 'muted',
  candidate: 'secondary',
  accepted: 'default',
  canonical: 'default',
  archived: 'muted',
}

export function entrySummaryLine(entry: LedgerEntry): string {
  return entry.record.title || entry.record_id
}
