"""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.agreement_information_10 import (
    AgreementInformation10,
)
from visaacceptancemergedspec.models.buyer_information_9 import (
    BuyerInformation9,
)
from visaacceptancemergedspec.models.client_reference_information_26 import (
    ClientReferenceInformation26,
)
from visaacceptancemergedspec.models.device_information_7 import (
    DeviceInformation7,
)
from visaacceptancemergedspec.models.merchant_defined_information import (
    MerchantDefinedInformation,
)
from visaacceptancemergedspec.models.merchant_information_14 import (
    MerchantInformation14,
)
from visaacceptancemergedspec.models.order_information_26 import (
    OrderInformation26,
)
from visaacceptancemergedspec.models.payment_information_22 import (
    PaymentInformation22,
)
from visaacceptancemergedspec.models.processing_information_23 import (
    ProcessingInformation23,
)
from visaacceptancemergedspec.models.travel_information_6 import (
    TravelInformation6,
)
from visaacceptancemergedspec.models.user_interface import (
    UserInterface,
)


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

    Attributes:
        client_reference_information (ClientReferenceInformation26): The model
            property of type ClientReferenceInformation26.
        processing_information (ProcessingInformation23): The model property of type
            ProcessingInformation23.
        payment_information (PaymentInformation22): The model property of type
            PaymentInformation22.
        order_information (OrderInformation26): The model property of type
            OrderInformation26.
        buyer_information (BuyerInformation9): The model property of type
            BuyerInformation9.
        device_information (DeviceInformation7): The model property of type
            DeviceInformation7.
        merchant_information (MerchantInformation14): The model property of type
            MerchantInformation14.
        user_interface (UserInterface): The model property of type UserInterface.
        merchant_defined_information (List[MerchantDefinedInformation]): The object
            containing the custom data that the merchant defines.
        agreement_information (AgreementInformation10): The model property of type
            AgreementInformation10.
        travel_information (TravelInformation6): The model property of type
            TravelInformation6.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_reference_information": "clientReferenceInformation",
        "processing_information": "processingInformation",
        "payment_information": "paymentInformation",
        "order_information": "orderInformation",
        "buyer_information": "buyerInformation",
        "device_information": "deviceInformation",
        "merchant_information": "merchantInformation",
        "user_interface": "userInterface",
        "merchant_defined_information": "merchantDefinedInformation",
        "agreement_information": "agreementInformation",
        "travel_information": "travelInformation",
    }

    _optionals = [
        "client_reference_information",
        "processing_information",
        "payment_information",
        "order_information",
        "buyer_information",
        "device_information",
        "merchant_information",
        "user_interface",
        "merchant_defined_information",
        "agreement_information",
        "travel_information",
    ]

    def __init__(
        self,
        client_reference_information=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        buyer_information=APIHelper.SKIP,
        device_information=APIHelper.SKIP,
        merchant_information=APIHelper.SKIP,
        user_interface=APIHelper.SKIP,
        merchant_defined_information=APIHelper.SKIP,
        agreement_information=APIHelper.SKIP,
        travel_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a CreateSessionReq instance."""
        # Initialize members of the class
        if client_reference_information is not APIHelper.SKIP:
            self.client_reference_information = client_reference_information
        if processing_information is not APIHelper.SKIP:
            self.processing_information = processing_information
        if payment_information is not APIHelper.SKIP:
            self.payment_information = payment_information
        if order_information is not APIHelper.SKIP:
            self.order_information = order_information
        if buyer_information is not APIHelper.SKIP:
            self.buyer_information = buyer_information
        if device_information is not APIHelper.SKIP:
            self.device_information = device_information
        if merchant_information is not APIHelper.SKIP:
            self.merchant_information = merchant_information
        if user_interface is not APIHelper.SKIP:
            self.user_interface = user_interface
        if merchant_defined_information is not APIHelper.SKIP:
            self.merchant_defined_information = merchant_defined_information
        if agreement_information is not APIHelper.SKIP:
            self.agreement_information = agreement_information
        if travel_information is not APIHelper.SKIP:
            self.travel_information = travel_information

        # 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
        client_reference_information =\
            ClientReferenceInformation26.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            ProcessingInformation23.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation22.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation26.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                else APIHelper.SKIP
        buyer_information =\
            BuyerInformation9.from_dictionary(
                dictionary.get("buyerInformation"))\
                if "buyerInformation" in dictionary.keys()\
                else APIHelper.SKIP
        device_information =\
            DeviceInformation7.from_dictionary(
                dictionary.get("deviceInformation"))\
                if "deviceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        merchant_information =\
            MerchantInformation14.from_dictionary(
                dictionary.get("merchantInformation"))\
                if "merchantInformation" in dictionary.keys()\
                else APIHelper.SKIP
        user_interface =\
            UserInterface.from_dictionary(
                dictionary.get("userInterface"))\
                if "userInterface" in dictionary.keys()\
                else APIHelper.SKIP
        merchant_defined_information = None
        if dictionary.get("merchantDefinedInformation") is not None:
            merchant_defined_information = [
                MerchantDefinedInformation.from_dictionary(x)
                    for x in dictionary.get("merchantDefinedInformation")
            ]
        else:
            merchant_defined_information = APIHelper.SKIP
        agreement_information =\
            AgreementInformation10.from_dictionary(
                dictionary.get("agreementInformation"))\
                if "agreementInformation" in dictionary.keys()\
                else APIHelper.SKIP
        travel_information =\
            TravelInformation6.from_dictionary(
                dictionary.get("travelInformation"))\
                if "travelInformation" in dictionary.keys()\
                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(client_reference_information,
                   processing_information,
                   payment_information,
                   order_information,
                   buyer_information,
                   device_information,
                   merchant_information,
                   user_interface,
                   merchant_defined_information,
                   agreement_information,
                   travel_information,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _device_information=(
            self.device_information
            if hasattr(self, "device_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_information")
            else None
        )
        _user_interface=(
            self.user_interface
            if hasattr(self, "user_interface")
            else None
        )
        _merchant_defined_information=(
            self.merchant_defined_information
            if hasattr(self, "merchant_defined_information")
            else None
        )
        _agreement_information=(
            self.agreement_information
            if hasattr(self, "agreement_information")
            else None
        )
        _travel_information=(
            self.travel_information
            if hasattr(self, "travel_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_reference_information={_client_reference_information!r}, "
            f"processing_information={_processing_information!r}, "
            f"payment_information={_payment_information!r}, "
            f"order_information={_order_information!r}, "
            f"buyer_information={_buyer_information!r}, "
            f"device_information={_device_information!r}, "
            f"merchant_information={_merchant_information!r}, "
            f"user_interface={_user_interface!r}, "
            f"merchant_defined_information={_merchant_defined_information!r}, "
            f"agreement_information={_agreement_information!r}, "
            f"travel_information={_travel_information!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _device_information=(
            self.device_information
            if hasattr(self, "device_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_information")
            else None
        )
        _user_interface=(
            self.user_interface
            if hasattr(self, "user_interface")
            else None
        )
        _merchant_defined_information=(
            self.merchant_defined_information
            if hasattr(self, "merchant_defined_information")
            else None
        )
        _agreement_information=(
            self.agreement_information
            if hasattr(self, "agreement_information")
            else None
        )
        _travel_information=(
            self.travel_information
            if hasattr(self, "travel_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_reference_information={_client_reference_information!s}, "
            f"processing_information={_processing_information!s}, "
            f"payment_information={_payment_information!s}, "
            f"order_information={_order_information!s}, "
            f"buyer_information={_buyer_information!s}, "
            f"device_information={_device_information!s}, "
            f"merchant_information={_merchant_information!s}, "
            f"user_interface={_user_interface!s}, "
            f"merchant_defined_information={_merchant_defined_information!s}, "
            f"agreement_information={_agreement_information!s}, "
            f"travel_information={_travel_information!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
