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

export type EditorImagePanelMessages = {
  imageSourceLabel: string;
  imageSourceAria: string;
  imageSourceOptionUrl: string;
  imageSourceOptionUpload: string;

  imageUrlLabel: string;
  imageUrlAria: string;

  imageUploadLabel: string;
  imageUploadAria: string;

  altLabel: string;
  altAria: string;

  styleSectionTitle: string;

  cardBackgroundLabel: string;
  cardBackgroundPickerAria: string;
  cardBackgroundHexAria: string;

  alignLabel: string;
  alignAria: string;
  alignOptionLeft: string;
  alignOptionCenter: string;
  alignOptionRight: string;

  widthModeLabel: string;
  widthModeAria: string;
  widthModeOptionAuto: string;
  widthModeOptionFixed: string;

  fixedWidthLabel: string;
  fixedWidthUnitLabel: string;
  fixedWidthPresetSmall: string;
  fixedWidthPresetMedium: string;
  fixedWidthPresetLarge: string;

  borderRadiusLabel: string;
  borderRadiusPresetNone: string;
  borderRadiusPresetSmall: string;
  borderRadiusPresetMedium: string;
  borderRadiusPresetLarge: string;
  borderRadiusPresetFull: string;
};

const EDITOR_IMAGE_PANEL_MESSAGES: Record<AppLocale, EditorImagePanelMessages> = {
  en: {
    imageSourceLabel: "Image source",
    imageSourceAria: "Image source",
    imageSourceOptionUrl: "URL",
    imageSourceOptionUpload: "File upload",

    imageUrlLabel: "Image URL",
    imageUrlAria: "Image URL",

    imageUploadLabel: "Image file upload",
    imageUploadAria: "Image file upload",

    altLabel: "Alt text",
    altAria: "Alt text",

    styleSectionTitle: "Image style",

    cardBackgroundLabel: "Card background color",
    cardBackgroundPickerAria: "Image card background color picker",
    cardBackgroundHexAria: "Image card background color HEX",

    alignLabel: "Alignment",
    alignAria: "Image alignment",
    alignOptionLeft: "Left",
    alignOptionCenter: "Center",
    alignOptionRight: "Right",

    widthModeLabel: "Width mode",
    widthModeAria: "Image width mode",
    widthModeOptionAuto: "Fit to content",
    widthModeOptionFixed: "Fixed width",

    fixedWidthLabel: "Fixed width",
    fixedWidthUnitLabel: "(px)",
    fixedWidthPresetSmall: "Small",
    fixedWidthPresetMedium: "Medium",
    fixedWidthPresetLarge: "Wide",

    borderRadiusLabel: "Border radius",
    borderRadiusPresetNone: "None",
    borderRadiusPresetSmall: "Small",
    borderRadiusPresetMedium: "Medium",
    borderRadiusPresetLarge: "Large",
    borderRadiusPresetFull: "Fully rounded",
  },
  ko: {
    imageSourceLabel: "이미지 소스",
    imageSourceAria: "이미지 소스",
    imageSourceOptionUrl: "URL",
    imageSourceOptionUpload: "파일 업로드",

    imageUrlLabel: "이미지 URL",
    imageUrlAria: "이미지 URL",

    imageUploadLabel: "이미지 파일 업로드",
    imageUploadAria: "이미지 파일 업로드",

    altLabel: "대체 텍스트",
    altAria: "대체 텍스트",

    styleSectionTitle: "이미지 스타일",

    cardBackgroundLabel: "카드 배경색",
    cardBackgroundPickerAria: "이미지 카드 배경색 피커",
    cardBackgroundHexAria: "이미지 카드 배경색 HEX",

    alignLabel: "정렬",
    alignAria: "이미지 정렬",
    alignOptionLeft: "왼쪽",
    alignOptionCenter: "가운데",
    alignOptionRight: "오른쪽",

    widthModeLabel: "너비 모드",
    widthModeAria: "이미지 너비 모드",
    widthModeOptionAuto: "내용에 맞춤",
    widthModeOptionFixed: "고정 너비",

    fixedWidthLabel: "고정 너비",
    fixedWidthUnitLabel: "(px)",
    fixedWidthPresetSmall: "작게",
    fixedWidthPresetMedium: "보통",
    fixedWidthPresetLarge: "넓게",

    borderRadiusLabel: "모서리 둥글기",
    borderRadiusPresetNone: "없음",
    borderRadiusPresetSmall: "작게",
    borderRadiusPresetMedium: "보통",
    borderRadiusPresetLarge: "크게",
    borderRadiusPresetFull: "완전 둥글게",
  },
};

export function getEditorImagePanelMessages(
  locale: AppLocale | null | undefined,
): EditorImagePanelMessages {
  const key = (locale ?? DEFAULT_LOCALE) as AppLocale;
  return EDITOR_IMAGE_PANEL_MESSAGES[key] ?? EDITOR_IMAGE_PANEL_MESSAGES[DEFAULT_LOCALE];
}
