import translates from '@/common/constants/translates/translates' type EnumTranslateMap = Record type EnumsRegistry = Record export interface EnumTranslatedValue { value: string | null | undefined translate: string | null } export function translateEnumValue( enumKey: keyof typeof translates.enums, value: string | null | undefined, ): EnumTranslatedValue { const enumsRegistry = translates.enums as EnumsRegistry const enumMap = enumsRegistry[String(enumKey)] if (!value) { return { value, translate: null, } } return { value, translate: enumMap?.[value] ?? null, } }