import {
  DICTIONARY_NAMES,
  type DictionaryGroups,
  type UiDictionaries,
} from "../dictionaryTypes";

const labels: Partial<Record<string, string>> = {
  INTERNAL: "内部",
  ALL_AUTHENTICATED: "全体已登录用户",
  PUBLISHED: "已发布",
};

export function dictionaryFixture(): UiDictionaries {
  const dictionaries = Object.fromEntries(
    DICTIONARY_NAMES.map((name, index) => [
      name,
      name === "roleCodes" ? [
        { code: "ADMIN", label: "管理员", sortNo: 1 },
        { code: "USER", label: "普通用户", sortNo: 2 },
      ] : [{
        code: name === "securityLevels"
          ? "INTERNAL"
          : name === "visibilityTypes"
            ? "ALL_AUTHENTICATED"
            : name === "documentStatuses"
              ? "PUBLISHED"
              : `${name.toUpperCase()}_CODE`,
        label: name === "securityLevels"
          ? labels.INTERNAL
          : name === "visibilityTypes"
            ? labels.ALL_AUTHENTICATED
            : name === "documentStatuses"
              ? labels.PUBLISHED
              : `标签${index}`,
        sortNo: index,
      }],
    ]),
  ) as DictionaryGroups;
  return { version: "2026.1", locale: "zh-CN", dictionaries };
}
