import type { AppLocale } from "../locale";
import { DEFAULT_LOCALE } from "../locale";

export type EditorCanvasMessages = {
  emptyStateHint: string;
  previewFallbackTextBlock: string;
  previewFallbackButtonBlock: string;
  previewFallbackImageBlock: string;
  previewFallbackListBlock: string;
  previewFallbackDividerBlock: string;
  previewFallbackSectionBlock: string;
};

const EDITOR_CANVAS_MESSAGES: Record<AppLocale, EditorCanvasMessages> = {
  en: {
    emptyStateHint: 'Click the "Text" button on the left to add your first block.',
    previewFallbackTextBlock: "Text block",
    previewFallbackButtonBlock: "Button block",
    previewFallbackImageBlock: "Image block",
    previewFallbackListBlock: "List block",
    previewFallbackDividerBlock: "Divider block",
    previewFallbackSectionBlock: "Section block",
  },
  ko: {
    emptyStateHint: '왼쪽에서 "텍스트" 버튼을 눌러 블록을 추가해 보세요.',
    previewFallbackTextBlock: "텍스트 블록",
    previewFallbackButtonBlock: "버튼 블록",
    previewFallbackImageBlock: "이미지 블록",
    previewFallbackListBlock: "리스트 블록",
    previewFallbackDividerBlock: "구분선 블록",
    previewFallbackSectionBlock: "섹션 블록",
  },
};

export function getEditorCanvasMessages(
  locale: AppLocale | null | undefined,
): EditorCanvasMessages {
  const key = (locale ?? DEFAULT_LOCALE) as AppLocale;
  return EDITOR_CANVAS_MESSAGES[key] ?? EDITOR_CANVAS_MESSAGES[DEFAULT_LOCALE];
}
