"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.account_1 import (
    Account1,
)


class SenderInformation(object):
    """Implementation of the 'SenderInformation' model.

    Attributes:
        first_name (str): First name of the sender. This field is applicable for AFT
            and OCT transactions.   Only alpha numeric values are supported.Special
            characters not in the standard ASCII character set, are not supported and
            will be stripped before being sent to the processor.
        middle_name (str): Middle name of the sender. This field is applicable for
            AFT and OCT transactions.   Only alpha numeric values are supported.
            Special characters not in the standard ASCII character set, are not
            supported and will be stripped before being sent to sent to the processor.
        last_name (str): Last name of the sender. This field is applicable for AFT
            and OCT transactions.  Only alpha numeric values are supported. Special
            characters not in the standard ASCII character set, are not supported and
            will be stripped before being sent to sent to the processor.
        address_1 (str): The street address of the sender. This field is applicable
            for AFT transactions.     Only alpha numeric values are supported.
            Special characters not in the standard ASCII character set are not
            supported and will be stripped before being sent to sent to the processor.
        locality (str): The city or locality of the sender. This field is applicable
            for AFT transactions.  Only alpha numeric values are supported.  Special
            characters not in the standard ASCII character set are not supported and
            will be stripped before being sent to sent to the processor.
        administrative_area (str): The state or province of the sender. This field is
            applicable for AFT transactions when the sender country is US or CA. Else
            it is optional.  Must be a two character value
        country_code (str): The country associated with the address of the sender.
            This field is applicable for AFT transactions.   Must be a two character
            ISO country code.  For example, see [ISO Country Code](
        alias_name (str): Sender's alias name.
        reference_number (str): This field is applicable for AFT transactions.
            Contains a transaction reference number provided by the Merchant. Only
            alpha numeric values are supported.
        account (Account1): The model property of type Account1.
        postal_code (str): Postal code of sender.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "first_name": "firstName",
        "middle_name": "middleName",
        "last_name": "lastName",
        "address_1": "address1",
        "locality": "locality",
        "administrative_area": "administrativeArea",
        "country_code": "countryCode",
        "alias_name": "aliasName",
        "reference_number": "referenceNumber",
        "account": "account",
        "postal_code": "postalCode",
    }

    _optionals = [
        "first_name",
        "middle_name",
        "last_name",
        "address_1",
        "locality",
        "administrative_area",
        "country_code",
        "alias_name",
        "reference_number",
        "account",
        "postal_code",
    ]

    def __init__(
        self,
        first_name=APIHelper.SKIP,
        middle_name=APIHelper.SKIP,
        last_name=APIHelper.SKIP,
        address_1=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        administrative_area=APIHelper.SKIP,
        country_code=APIHelper.SKIP,
        alias_name=APIHelper.SKIP,
        reference_number=APIHelper.SKIP,
        account=APIHelper.SKIP,
        postal_code=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a SenderInformation instance."""
        # Initialize members of the class
        if first_name is not APIHelper.SKIP:
            self.first_name = first_name
        if middle_name is not APIHelper.SKIP:
            self.middle_name = middle_name
        if last_name is not APIHelper.SKIP:
            self.last_name = last_name
        if address_1 is not APIHelper.SKIP:
            self.address_1 = address_1
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if administrative_area is not APIHelper.SKIP:
            self.administrative_area = administrative_area
        if country_code is not APIHelper.SKIP:
            self.country_code = country_code
        if alias_name is not APIHelper.SKIP:
            self.alias_name = alias_name
        if reference_number is not APIHelper.SKIP:
            self.reference_number = reference_number
        if account is not APIHelper.SKIP:
            self.account = account
        if postal_code is not APIHelper.SKIP:
            self.postal_code = postal_code

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create 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 not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        first_name =\
            dictionary.get("firstName")\
            if dictionary.get("firstName")\
                else APIHelper.SKIP
        middle_name =\
            dictionary.get("middleName")\
            if dictionary.get("middleName")\
                else APIHelper.SKIP
        last_name =\
            dictionary.get("lastName")\
            if dictionary.get("lastName")\
                else APIHelper.SKIP
        address_1 =\
            dictionary.get("address1")\
            if dictionary.get("address1")\
                else APIHelper.SKIP
        locality =\
            dictionary.get("locality")\
            if dictionary.get("locality")\
                else APIHelper.SKIP
        administrative_area =\
            dictionary.get("administrativeArea")\
            if dictionary.get("administrativeArea")\
                else APIHelper.SKIP
        country_code =\
            dictionary.get("countryCode")\
            if dictionary.get("countryCode")\
                else APIHelper.SKIP
        alias_name =\
            dictionary.get("aliasName")\
            if dictionary.get("aliasName")\
                else APIHelper.SKIP
        reference_number =\
            dictionary.get("referenceNumber")\
            if dictionary.get("referenceNumber")\
                else APIHelper.SKIP
        account =\
            Account1.from_dictionary(
                dictionary.get("account"))\
                if "account" in dictionary.keys()\
                else APIHelper.SKIP
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(first_name,
                   middle_name,
                   last_name,
                   address_1,
                   locality,
                   administrative_area,
                   country_code,
                   alias_name,
                   reference_number,
                   account,
                   postal_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _first_name=(
            self.first_name
            if hasattr(self, "first_name")
            else None
        )
        _middle_name=(
            self.middle_name
            if hasattr(self, "middle_name")
            else None
        )
        _last_name=(
            self.last_name
            if hasattr(self, "last_name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _country_code=(
            self.country_code
            if hasattr(self, "country_code")
            else None
        )
        _alias_name=(
            self.alias_name
            if hasattr(self, "alias_name")
            else None
        )
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _account=(
            self.account
            if hasattr(self, "account")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"first_name={_first_name!r}, "
            f"middle_name={_middle_name!r}, "
            f"last_name={_last_name!r}, "
            f"address_1={_address_1!r}, "
            f"locality={_locality!r}, "
            f"administrative_area={_administrative_area!r}, "
            f"country_code={_country_code!r}, "
            f"alias_name={_alias_name!r}, "
            f"reference_number={_reference_number!r}, "
            f"account={_account!r}, "
            f"postal_code={_postal_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _first_name=(
            self.first_name
            if hasattr(self, "first_name")
            else None
        )
        _middle_name=(
            self.middle_name
            if hasattr(self, "middle_name")
            else None
        )
        _last_name=(
            self.last_name
            if hasattr(self, "last_name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _country_code=(
            self.country_code
            if hasattr(self, "country_code")
            else None
        )
        _alias_name=(
            self.alias_name
            if hasattr(self, "alias_name")
            else None
        )
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _account=(
            self.account
            if hasattr(self, "account")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"first_name={_first_name!s}, "
            f"middle_name={_middle_name!s}, "
            f"last_name={_last_name!s}, "
            f"address_1={_address_1!s}, "
            f"locality={_locality!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"country_code={_country_code!s}, "
            f"alias_name={_alias_name!s}, "
            f"reference_number={_reference_number!s}, "
            f"account={_account!s}, "
            f"postal_code={_postal_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
