"""visaacceptancemergedspec.

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

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


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

    Attributes:
        date_of_birth (str): Recipient’s date of birth. **Format**: `YYYYMMDD`.  This
            field is a `pass-through`, which means that Visa Acceptance ensures that
            the value is eight numeric characters but otherwise does not verify the
            value or modify it in any way before sending it to the processor. If the
            field is not required for the transaction, Visa Acceptance does not
            forward it to the processor.
        gender (str): Customer's gender. Possible values are F (female), M (male), O
            (other).
        language (str): language setting of the user
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "date_of_birth": "dateOfBirth",
        "gender": "gender",
        "language": "language",
    }

    _optionals = [
        "date_of_birth",
        "gender",
        "language",
    ]

    def __init__(
        self,
        date_of_birth=APIHelper.SKIP,
        gender=APIHelper.SKIP,
        language=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a BuyerInformation7 instance."""
        # Initialize members of the class
        if date_of_birth is not APIHelper.SKIP:
            self.date_of_birth = date_of_birth
        if gender is not APIHelper.SKIP:
            self.gender = gender
        if language is not APIHelper.SKIP:
            self.language = language

        # 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
        date_of_birth =\
            dictionary.get("dateOfBirth")\
            if dictionary.get("dateOfBirth")\
                else APIHelper.SKIP
        gender =\
            dictionary.get("gender")\
            if dictionary.get("gender")\
                else APIHelper.SKIP
        language =\
            dictionary.get("language")\
            if dictionary.get("language")\
                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(date_of_birth,
                   gender,
                   language,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _date_of_birth=(
            self.date_of_birth
            if hasattr(self, "date_of_birth")
            else None
        )
        _gender=(
            self.gender
            if hasattr(self, "gender")
            else None
        )
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"date_of_birth={_date_of_birth!r}, "
            f"gender={_gender!r}, "
            f"language={_language!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _date_of_birth=(
            self.date_of_birth
            if hasattr(self, "date_of_birth")
            else None
        )
        _gender=(
            self.gender
            if hasattr(self, "gender")
            else None
        )
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"date_of_birth={_date_of_birth!s}, "
            f"gender={_gender!s}, "
            f"language={_language!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
