# -*- coding: utf-8 -*-


class UserID(object):

    """Implementation of the 'UserID' model.

    This group consists of all possible user identifier types. The 'epUserID'
    field is a unique identifier for a merchant and is the equivalent of a
    Virtual Account Number (VAN). The 'merchantUserID' is a merchant specified
    identifier for an individual or company that an account was set up for.
    The 'epUserID', 'merchantUserID' or both 'epUserID' and 'merchantUserID'
    can be supplied. A mapping will be performed to retrieve the merchant user
    ID from the supplied EP user ID and vice versa. If both the 'epUserID' and
    'merchantUserID' are supplied, a check will be performed to ensure that
    the two are mapped. If the two provided fields are not mapped, then a
    validation error code will be returned. At least one of the fields must be
    populated.

    Attributes:
        ep_user_id (long|int): user’s unique id generated by EarthPort. This
            is also called the VAN (Virtual Account Number.
        merchant_user_id (string): A unique reference for the merchant that
            identifies the person or company on behalf of which this account
            was set up. This needs to be used to reference KYC data held by
            the merchant (amongst other things). This is often a unique
            username or reference allocated by the merchant at user
            registration time.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "ep_user_id":'epUserID',
        "merchant_user_id":'merchantUserID'
    }

    def __init__(self,
                 ep_user_id=None,
                 merchant_user_id=None):
        """Constructor for the UserID class"""

        # Initialize members of the class
        self.ep_user_id = ep_user_id
        self.merchant_user_id = merchant_user_id


    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object as
            obtained from the deserialization of the server's response. The keys
            MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if dictionary is None:
            return None

        # Extract variables from the dictionary
        ep_user_id = dictionary.get('epUserID')
        merchant_user_id = dictionary.get('merchantUserID')

        # Return an object of this model
        return cls(ep_user_id,
                   merchant_user_id)


