import { formatDate, getPersonParameters } from '@kit/shared/utils';

export function getResultSetName(
  title: string,
  isPackage: boolean,
  nrOfElements: number,
) {
  return !isPackage && nrOfElements > 1 ? 'doctor:analyses' : title;
}

export function getDOBWithAgeStringFromPersonalCode(
  personalCode: string | null,
) {
  if (!personalCode) return 'common:unknown';

  const person = getPersonParameters(personalCode);

  if (!person) return 'common:unknown';

  return `${formatDate(person.dob.toString())} (${person.age})`;
}
