# By: Riasat Ullah

# This class represents a user. It provides a
# set of functions that the user can perform.
# Data passed to this class must already be validated.


class User(object):

    def __init__(self, user_id, first_name, last_name, email, iso_code, country_code, phone, policy_id,
                 preferred_username, taskcall_email, organization_id, timezone, language, profile_picture):

        # No data assertion tests are done here to save processing time.
        # Assertions are done before queries are inserted into the database.
        self.user_id = user_id
        self.first_name = first_name
        self.last_name = last_name
        self.email = email
        self.iso_country_code = iso_code
        self.country_code = country_code
        self.phone = phone
        self.policy_id = policy_id
        self.preferred_username = preferred_username
        self.taskcall_email = taskcall_email
        self.organization_id = organization_id
        self.timezone = timezone
        self.language = language
        self.profile_picture = profile_picture

    def to_dict(self):
        '''
        Gets the dict of the User object.
        :return: dict of User object
        '''
        return self.__dict__

    def equivalent_to(self, new_user):
        '''
        Checks if two users are the same or not.
        :param new_user: the User object to compare against
        :return: (boolean) True if they are the same; False otherwise
        '''
        assert isinstance(new_user, User)
        if self.to_dict() == new_user.to_dict():
            return True
        return False
