def user_password_reset_check_email_send(*, user_id: int) -> BaseUser:

    user = user_by_id(id=user_id)

    subject = 'Reestablecimiento de contraseña'
    body_text = f'Hola {user.first_name} {user.last_name} tu contraseña '\
              'ha sido correctamente establecida.'

    email_send(subject=subject,
               body_text=body_text,
               user_id=user_id,
               body_html=None)

    return user
def user_update_profile_email_send(*, user_id: int) -> BaseUser:

    # Obtain user
    user = user_by_id(id=user_id)

    subject = 'Actualización de perfil.'
    body_text = f'{user.first_name} {user.last_name} \n'\
              'Tu perfil ha sido actualizado con éxito.'

    email_send(subject=subject,
               body_text=body_text,
               user_id=user_id,
               body_html=None)

    return user
def user_password_change_email_send(*, user_id: int) -> BaseUser:

    # Obtain user
    user = user_by_id(id=user_id)

    subject = 'Reestablecimiento de contraseña.'
    body_text = f'{user.first_name} {user.last_name}'\
              'Tu contraseña ha sido reestablecida con éxito.'

    email_send(subject=subject,
               body_text=body_text,
               user_id=user_id,
               body_html=None)

    return user
def user_password_reset_email_send(*, user_id: int, token: str):

    # Obtain user
    user = user_by_id(id=user_id)

    subject = 'Reestablecimiento de contraseña.'
    body_text = f'{user.first_name} {user.last_name} '\
              f'\n Copia el siguiente código para poder reestablecer tu contraseña \n {token}'

    email_send(subject=subject,
               body_text=body_text,
               user_id=user_id,
               body_html=None)

    return user
def user_create_email_send(*, user_id: int) -> BaseUser:
    # Obtain user
    user = user_by_id(id=user_id)

    subject = 'Creación de cuenta.'
    body_text = f'{user.first_name} {user.last_name} '\
              'Gracias por formar parte de nosotros.'\
              '\nPor este medio estaremos en constante aviso '\
              'sobre eventos o sucesos del consultorio.'

    email_send(subject=subject,
               body_text=body_text,
               user_id=user_id,
               body_html=None)

    return user
def appointment_accept_email_send(
    *,
    appointment_id: int,
    user_id: int
    ):

    appointment = appointment_by_id(id=appointment_id)
    
    user = user_by_id(id=user_id)
    
    subject = 'Reutilización de cita médica.'
    body_text = f'{user.first_name} {user.last_name}'\
              f'\nSu cita médica con fecha {appointment.date} y hora '\
              f'{appointment.time} ha sido asignada con éxito.'
    
    email_send(subject=subject, body_text=body_text, user_id=user_id, body_html=None)
    
    return user
def appointment_create_email_send(
    *,
    user_id: int,
    appointment_id: int
    ):
    """Allows to notify to user


    Parameters:
    user_id -- User id Appointment
    appointment_id -- Appointment id
    """

    user = user_by_id(id = user_id)
    appointment = appointment_by_id(id = appointment_id)

    subject = 'Asignación de cita médica.'
    body_text = f'{user.first_name} {user.last_name}'\
              f'\nSu cita médica con fecha {appointment.date} y hora '\
              f'{appointment.time} ha sido asignada con éxito.'

    email_send(subject = subject, body_text = body_text, user_id=user_id, body_html=None)

    return user
def appointment_remember_email_send(
    *,
    appointment_id,
    user_id: int
    ):
    """Allows to notify a user when an appointment is one day away


    Parameters:
    appointment -- Object Appointment
    """
    appointment = appointment_by_id(id = appointment_id)

    user = user_by_id(id = user_id)

    subject = 'Recordatorio de cita médica'
    body_text = f'{user.first_name} {user.last_name}:'\
              f'Le recordamos su cita médica con fecha {appointment.date} y hora {appointment.time} '\
              f'se realizará en 24 horas.\n'\
              f'Estaremos en constante notificación sobre eventos y anuncios del consultorio.'     

    email_send(subject=subject, body_text=body_text, user_id=user_id, body_html=None)
    
    return user