import { Gender, GenderTranslation } from "ChillMainAssets/types";

/**
 * Translates a given gender object into its corresponding gender translation string.
 *
 * @param {Gender|null} gender - The gender object to be translated, null values are also supported
 * @return {GenderTranslation} Returns the gender translation string corresponding to the provided gender,
 *                             or "unknown" if the gender is null.
 */
export function toGenderTranslation(gender: Gender | null): GenderTranslation {
  if (null === gender) {
    return "unknown";
  }

  return gender.genderTranslation;
}
