import * as countries from "i18n-iso-countries";
import * as ru from "i18n-iso-countries/langs/ru.json";
import * as en from "i18n-iso-countries/langs/en.json";
import * as zh from "i18n-iso-countries/langs/zh.json";

countries.registerLocale(ru);
countries.registerLocale(en);
countries.registerLocale(zh);

const generateCountriesList = (locale: string) => {
  const names = countries.getNames(locale);
  return Object.entries(names).map(([code, name]) => ({
    code: code,
    name: name,
  }));
};

export const API_URL = import.meta.env.VITE_API_URL;

export const MEDIA_TYPE_LABELS = {
  1: "Фото",
  2: "Видео",
  3: "Иконка",
  4: "Водяной знак",
  5: "Панорама",
  6: "3Д-модель",
};

export * from "./mediaTypes";

export const MEDIA_TYPE_VALUES = {
  image: 1,
  video: 2,
  icon: 3,
  thumbnail: 3,
  alt_icon: 3,
  watermark_lu: 4,
  watermark_rd: 4,
  panorama: 5,
  model: 6,
  video_preview: 2,
};

export const RU_COUNTRIES = generateCountriesList("ru");
export const EN_COUNTRIES = generateCountriesList("en");
export const ZH_COUNTRIES = generateCountriesList("zh");
