import { isEmail } from '../../../utils' import { Person, SmartfitHelper } from '../../smartfit' import { Patient, MALE, FEMALE } from '../../../models' export function personToPatient(person: Person, login: string): Patient { return new Patient({ document_number: !isEmail(login) ? login : null, email: person.email, name: person.name, cell_phone: person.phone, gender_id: person.gender === 'Masculino' ? MALE : FEMALE, birth_date: person.birthdate, collaborator: person.isCollaborator, country_code: SmartfitHelper.getCountryCodeByLocationCountry(person.locationCountry), smartfit_token: person.authToken, is_smartfit: !!person.authToken, smartfit_unit_acronym: person.locationAcronym, smartfit_id: person.id, smartfit_main_purchase_id: person.mainPurchaseId, smartfit_unit_id: person.locationId, }) }