export type LanguageType = {
  id: string;
  name: string;
};

let languageList: LanguageType[] = [];

export const setVideoLangs = (data: LanguageType[]) => {
  languageList = data?.sort((a, b) => a.name.localeCompare(b.name)) ?? [];
};

export const getVideoLangs = () => languageList.slice();

export const getLanguageOptions = () =>
  languageList.map((lang) => ({
    label: lang.name,
    value: lang.id,
  }));
