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

export type EditorTextPanelMessages = {
  selectedTextLabel: string;
  selectedTextAria: string;
  alignLabel: string;
  alignAria: string;
  alignOptionLeft: string;
  alignOptionCenter: string;
  alignOptionRight: string;
  textStyleLabel: string;
  underlineLabel: string;
  strikeLabel: string;
  italicLabel: string;
  fontSizeLabel: string;
  fontSizeUnitLabel: string;
  letterSpacingLabel: string;
  letterSpacingPresetAria: string;
  letterSpacingSliderAria: string;
  letterSpacingInputAria: string;
  letterSpacingPresetTighter: string;
  letterSpacingPresetTight: string;
  letterSpacingPresetNormal: string;
  letterSpacingPresetWide: string;
  letterSpacingPresetWider: string;
  lineHeightLabel: string;
  lineHeightPresetTight: string;
  lineHeightPresetSnug: string;
  lineHeightPresetNormal: string;
  lineHeightPresetRelaxed: string;
  lineHeightPresetLoose: string;
  fontWeightLabel: string;
  fontWeightPresetNormal: string;
  fontWeightPresetMedium: string;
  fontWeightPresetSemibold: string;
  fontWeightPresetBold: string;
  textColorLabel: string;
  textColorPickerAria: string;
  textColorHexAria: string;
  backgroundColorLabel: string;
  backgroundColorPickerAria: string;
  backgroundColorHexAria: string;
  maxWidthLabel: string;
  maxWidthPresetAria: string;
  maxWidthSliderAria: string;
  maxWidthCustomAria: string;
  maxWidthPlaceholder: string;
  maxWidthPresetNone: string;
  maxWidthPresetProse: string;
  maxWidthPresetNarrow: string;
};

const EDITOR_TEXT_PANEL_MESSAGES: Record<AppLocale, EditorTextPanelMessages> = {
  en: {
    selectedTextLabel: "Selected text block content",
    selectedTextAria: "Selected text block content",
    alignLabel: "Alignment",
    alignAria: "Alignment",
    alignOptionLeft: "Left",
    alignOptionCenter: "Center",
    alignOptionRight: "Right",
    textStyleLabel: "Text style",
    underlineLabel: "Underline",
    strikeLabel: "Strikethrough",
    italicLabel: "Italic",
    fontSizeLabel: "Font size",
    fontSizeUnitLabel: "(px)",
    letterSpacingLabel: "Letter spacing",
    letterSpacingPresetAria: "Letter spacing preset",
    letterSpacingSliderAria: "Letter spacing slider",
    letterSpacingInputAria: "Letter spacing custom",
    letterSpacingPresetTighter: "Very tight",
    letterSpacingPresetTight: "Tight",
    letterSpacingPresetNormal: "Normal",
    letterSpacingPresetWide: "Wide",
    letterSpacingPresetWider: "Very wide",
    lineHeightLabel: "Line height",
    lineHeightPresetTight: "Tight",
    lineHeightPresetSnug: "Slightly tight",
    lineHeightPresetNormal: "Normal",
    lineHeightPresetRelaxed: "Relaxed",
    lineHeightPresetLoose: "Loose",
    fontWeightLabel: "Weight",
    fontWeightPresetNormal: "Regular",
    fontWeightPresetMedium: "Medium",
    fontWeightPresetSemibold: "Semibold",
    fontWeightPresetBold: "Bold",
    textColorLabel: "Text color",
    textColorPickerAria: "Text color picker",
    textColorHexAria: "Text color HEX",
    backgroundColorLabel: "Block background color",
    backgroundColorPickerAria: "Text block background color picker",
    backgroundColorHexAria: "Text block background color HEX",
    maxWidthLabel: "Max width",
    maxWidthPresetAria: "Max width preset",
    maxWidthSliderAria: "Max width slider (ch)",
    maxWidthCustomAria: "Max width custom",
    maxWidthPlaceholder: "e.g. 600px, 40rem, 80%, 60ch",
    maxWidthPresetNone: "No limit",
    maxWidthPresetProse: "Body width (60ch)",
    maxWidthPresetNarrow: "Narrow (40ch)",
  },
  ko: {
    selectedTextLabel: "선택한 텍스트 블록 내용",
    selectedTextAria: "선택한 텍스트 블록 내용",
    alignLabel: "정렬",
    alignAria: "정렬",
    alignOptionLeft: "왼쪽",
    alignOptionCenter: "가운데",
    alignOptionRight: "오른쪽",
    textStyleLabel: "텍스트 스타일",
    underlineLabel: "밑줄",
    strikeLabel: "가운데줄",
    italicLabel: "이탤릭",
    fontSizeLabel: "글자 크기",
    fontSizeUnitLabel: "(px)",
    letterSpacingLabel: "글자 간격",
    letterSpacingPresetAria: "글자 간격 프리셋",
    letterSpacingSliderAria: "글자 간격 슬라이더",
    letterSpacingInputAria: "글자 간격 커스텀",
    letterSpacingPresetTighter: "아주 좁게",
    letterSpacingPresetTight: "좁게",
    letterSpacingPresetNormal: "보통",
    letterSpacingPresetWide: "넓게",
    letterSpacingPresetWider: "아주 넓게",
    lineHeightLabel: "줄 간격",
    lineHeightPresetTight: "좁게",
    lineHeightPresetSnug: "약간 좁게",
    lineHeightPresetNormal: "보통",
    lineHeightPresetRelaxed: "넓게",
    lineHeightPresetLoose: "아주 넓게",
    fontWeightLabel: "굵기",
    fontWeightPresetNormal: "보통",
    fontWeightPresetMedium: "중간",
    fontWeightPresetSemibold: "세미볼드",
    fontWeightPresetBold: "볼드",
    textColorLabel: "텍스트 색상",
    textColorPickerAria: "텍스트 색상 피커",
    textColorHexAria: "텍스트 색상 HEX",
    backgroundColorLabel: "블록 배경색",
    backgroundColorPickerAria: "텍스트 블록 배경색 피커",
    backgroundColorHexAria: "텍스트 블록 배경색 HEX",
    maxWidthLabel: "최대 너비",
    maxWidthPresetAria: "최대 너비 프리셋",
    maxWidthSliderAria: "최대 너비 슬라이더 (ch 단위)",
    maxWidthCustomAria: "최대 너비 커스텀",
    maxWidthPlaceholder: "예: 600px, 40rem, 80%, 60ch",
    maxWidthPresetNone: "제한 없음",
    maxWidthPresetProse: "본문 폭 (60ch)",
    maxWidthPresetNarrow: "좁게 (40ch)",
  },
};

export function getEditorTextPanelMessages(
  locale: AppLocale | null | undefined,
): EditorTextPanelMessages {
  const key = (locale ?? DEFAULT_LOCALE) as AppLocale;
  return EDITOR_TEXT_PANEL_MESSAGES[key] ?? EDITOR_TEXT_PANEL_MESSAGES[DEFAULT_LOCALE];
}
