"""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_4 import (
    ClientReferenceInformation4,
)
from visaacceptancemergedspec.models.order_information_4 import (
    OrderInformation4,
)
from visaacceptancemergedspec.models.payment_information_3 import (
    PaymentInformation3,
)
from visaacceptancemergedspec.models.point_of_sale_information_2 import (
    PointOfSaleInformation2,
)
from visaacceptancemergedspec.models.processing_information_3 import (
    ProcessingInformation3,
)
from visaacceptancemergedspec.models.processor_information_3 import (
    ProcessorInformation3,
)
from visaacceptancemergedspec.models.reversal_information import (
    ReversalInformation,
)


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

    Attributes:
        client_reference_information (ClientReferenceInformation4): The model
            property of type ClientReferenceInformation4.
        reversal_information (ReversalInformation): The model property of type
            ReversalInformation.
        processing_information (ProcessingInformation3): The model property of type
            ProcessingInformation3.
        order_information (OrderInformation4): The model property of type
            OrderInformation4.
        point_of_sale_information (PointOfSaleInformation2): The model property of
            type PointOfSaleInformation2.
        payment_information (PaymentInformation3): The model property of type
            PaymentInformation3.
        processor_information (ProcessorInformation3): The model property of type
            ProcessorInformation3.
        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",
        "reversal_information": "reversalInformation",
        "processing_information": "processingInformation",
        "order_information": "orderInformation",
        "point_of_sale_information": "pointOfSaleInformation",
        "payment_information": "paymentInformation",
        "processor_information": "processorInformation",
    }

    _optionals = [
        "client_reference_information",
        "reversal_information",
        "processing_information",
        "order_information",
        "point_of_sale_information",
        "payment_information",
        "processor_information",
    ]

    def __init__(
        self,
        client_reference_information=APIHelper.SKIP,
        reversal_information=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        point_of_sale_information=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        processor_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a AuthReversalRequest instance."""
        # Initialize members of the class
        if client_reference_information is not APIHelper.SKIP:
            self.client_reference_information = client_reference_information
        if reversal_information is not APIHelper.SKIP:
            self.reversal_information = reversal_information
        if processing_information is not APIHelper.SKIP:
            self.processing_information = processing_information
        if order_information is not APIHelper.SKIP:
            self.order_information = order_information
        if point_of_sale_information is not APIHelper.SKIP:
            self.point_of_sale_information = point_of_sale_information
        if payment_information is not APIHelper.SKIP:
            self.payment_information = payment_information
        if processor_information is not APIHelper.SKIP:
            self.processor_information = processor_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 =\
            ClientReferenceInformation4.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        reversal_information =\
            ReversalInformation.from_dictionary(
                dictionary.get("reversalInformation"))\
                if "reversalInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            ProcessingInformation3.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation4.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                else APIHelper.SKIP
        point_of_sale_information =\
            PointOfSaleInformation2.from_dictionary(
                dictionary.get("pointOfSaleInformation"))\
                if "pointOfSaleInformation" in dictionary.keys()\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation3.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processor_information =\
            ProcessorInformation3.from_dictionary(
                dictionary.get("processorInformation"))\
                if "processorInformation" 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,
                   reversal_information,
                   processing_information,
                   order_information,
                   point_of_sale_information,
                   payment_information,
                   processor_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
        )
        _reversal_information=(
            self.reversal_information
            if hasattr(self, "reversal_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _point_of_sale_information=(
            self.point_of_sale_information
            if hasattr(self, "point_of_sale_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _processor_information=(
            self.processor_information
            if hasattr(self, "processor_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_reference_information={_client_reference_information!r}, "
            f"reversal_information={_reversal_information!r}, "
            f"processing_information={_processing_information!r}, "
            f"order_information={_order_information!r}, "
            f"point_of_sale_information={_point_of_sale_information!r}, "
            f"payment_information={_payment_information!r}, "
            f"processor_information={_processor_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
        )
        _reversal_information=(
            self.reversal_information
            if hasattr(self, "reversal_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _point_of_sale_information=(
            self.point_of_sale_information
            if hasattr(self, "point_of_sale_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _processor_information=(
            self.processor_information
            if hasattr(self, "processor_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_reference_information={_client_reference_information!s}, "
            f"reversal_information={_reversal_information!s}, "
            f"processing_information={_processing_information!s}, "
            f"order_information={_order_information!s}, "
            f"point_of_sale_information={_point_of_sale_information!s}, "
            f"payment_information={_payment_information!s}, "
            f"processor_information={_processor_information!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
