"""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.client_reference_information_3 import (
    ClientReferenceInformation3,
)
from visaacceptancemergedspec.models.order_information_24 import (
    OrderInformation24,
)
from visaacceptancemergedspec.models.payment_information_20 import (
    PaymentInformation20,
)
from visaacceptancemergedspec.models.processing_information_21 import (
    ProcessingInformation21,
)


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

    Attributes:
        client_reference_information (ClientReferenceInformation3): The model
            property of type ClientReferenceInformation3.
        processing_information (ProcessingInformation21): The model property of type
            ProcessingInformation21.
        payment_information (PaymentInformation20): The model property of type
            PaymentInformation20.
        order_information (OrderInformation24): The model property of type
            OrderInformation24.
        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",
    }

    _optionals = [
        "client_reference_information",
        "processing_information",
        "payment_information",
        "order_information",
    ]

    def __init__(
        self,
        client_reference_information=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a OrderPaymentRequest 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

        # 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 =\
            ClientReferenceInformation3.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            ProcessingInformation21.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation20.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation24.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" 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,
                   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
        )
        _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"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
        )
        _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"additional_properties={_additional_properties!s}, "
            f")"
        )
