"""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.buyer_information_8 import (
    BuyerInformation8,
)
from visaacceptancemergedspec.models.client_reference_information_3 import (
    ClientReferenceInformation3,
)
from visaacceptancemergedspec.models.order_information_25 import (
    OrderInformation25,
)
from visaacceptancemergedspec.models.payment_information_21 import (
    PaymentInformation21,
)
from visaacceptancemergedspec.models.processing_information_22 import (
    ProcessingInformation22,
)
from visaacceptancemergedspec.models.processor_information_19 import (
    ProcessorInformation19,
)
from visaacceptancemergedspec.models.risk_information_4 import (
    RiskInformation4,
)


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

    Attributes:
        id (str): An unique identification number generated by Visa Acceptance to
            identify the submitted request. Returned by all services. It is also
            appended to the endpoint of the resource. On incremental authorizations,
            this value with be the same as the identification number returned in the
            original authorization response.
        client_reference_information (ClientReferenceInformation3): The model
            property of type ClientReferenceInformation3.
        processor_information (ProcessorInformation19): The model property of type
            ProcessorInformation19.
        order_information (OrderInformation25): The model property of type
            OrderInformation25.
        payment_information (PaymentInformation21): The model property of type
            PaymentInformation21.
        processing_information (ProcessingInformation22): The model property of type
            ProcessingInformation22.
        buyer_information (BuyerInformation8): The model property of type
            BuyerInformation8.
        submit_time_utc (str): Time of request in UTC. Format: `YYYY-MM-DDThh:mm:ssZ`
            **Example** `2016-08-11T22:47:57Z` equals August 11, 2016, at 22:47:57
            (10:47:57 p.m.). The `T` separates the date and the time. The `Z`
            indicates UTC.  Returned by Visa Acceptance for all services.
        status (str): The status of the submitted transaction. Possible values:   -
            CREATED   - SAVED   - APPROVED   - VOIDED   - COMPLETED   -
            PAYER_ACTION_REQUIRED
        reconciliation_id (str): Reference number for the transaction. Depending on
            how your Visa Acceptance account is configured, this value could either
            be provided in the API request or generated by Visa Acceptance. The
            actual value used in the request to the processor is provided back to you
            by Visa Acceptance in the response.
        risk_information (RiskInformation4): The model property of type
            RiskInformation4.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "id",
        "client_reference_information": "clientReferenceInformation",
        "processor_information": "processorInformation",
        "order_information": "orderInformation",
        "payment_information": "paymentInformation",
        "processing_information": "processingInformation",
        "buyer_information": "buyerInformation",
        "submit_time_utc": "submitTimeUtc",
        "status": "status",
        "reconciliation_id": "reconciliationId",
        "risk_information": "riskInformation",
    }

    _optionals = [
        "id",
        "client_reference_information",
        "processor_information",
        "order_information",
        "payment_information",
        "processing_information",
        "buyer_information",
        "submit_time_utc",
        "status",
        "reconciliation_id",
        "risk_information",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        client_reference_information=APIHelper.SKIP,
        processor_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        buyer_information=APIHelper.SKIP,
        submit_time_utc=APIHelper.SKIP,
        status=APIHelper.SKIP,
        reconciliation_id=APIHelper.SKIP,
        risk_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PtsV2PaymentsOrderPost201Response instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if client_reference_information is not APIHelper.SKIP:
            self.client_reference_information = client_reference_information
        if processor_information is not APIHelper.SKIP:
            self.processor_information = processor_information
        if order_information is not APIHelper.SKIP:
            self.order_information = order_information
        if payment_information is not APIHelper.SKIP:
            self.payment_information = payment_information
        if processing_information is not APIHelper.SKIP:
            self.processing_information = processing_information
        if buyer_information is not APIHelper.SKIP:
            self.buyer_information = buyer_information
        if submit_time_utc is not APIHelper.SKIP:
            self.submit_time_utc = submit_time_utc
        if status is not APIHelper.SKIP:
            self.status = status
        if reconciliation_id is not APIHelper.SKIP:
            self.reconciliation_id = reconciliation_id
        if risk_information is not APIHelper.SKIP:
            self.risk_information = risk_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
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        client_reference_information =\
            ClientReferenceInformation3.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processor_information =\
            ProcessorInformation19.from_dictionary(
                dictionary.get("processorInformation"))\
                if "processorInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation25.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation21.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            ProcessingInformation22.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        buyer_information =\
            BuyerInformation8.from_dictionary(
                dictionary.get("buyerInformation"))\
                if "buyerInformation" in dictionary.keys()\
                else APIHelper.SKIP
        submit_time_utc =\
            dictionary.get("submitTimeUtc")\
            if dictionary.get("submitTimeUtc")\
                else APIHelper.SKIP
        status =\
            dictionary.get("status")\
            if dictionary.get("status")\
                else APIHelper.SKIP
        reconciliation_id =\
            dictionary.get("reconciliationId")\
            if dictionary.get("reconciliationId")\
                else APIHelper.SKIP
        risk_information =\
            RiskInformation4.from_dictionary(
                dictionary.get("riskInformation"))\
                if "riskInformation" 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(id,
                   client_reference_information,
                   processor_information,
                   order_information,
                   payment_information,
                   processing_information,
                   buyer_information,
                   submit_time_utc,
                   status,
                   reconciliation_id,
                   risk_information,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _processor_information=(
            self.processor_information
            if hasattr(self, "processor_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _submit_time_utc=(
            self.submit_time_utc
            if hasattr(self, "submit_time_utc")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _risk_information=(
            self.risk_information
            if hasattr(self, "risk_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"client_reference_information={_client_reference_information!r}, "
            f"processor_information={_processor_information!r}, "
            f"order_information={_order_information!r}, "
            f"payment_information={_payment_information!r}, "
            f"processing_information={_processing_information!r}, "
            f"buyer_information={_buyer_information!r}, "
            f"submit_time_utc={_submit_time_utc!r}, "
            f"status={_status!r}, "
            f"reconciliation_id={_reconciliation_id!r}, "
            f"risk_information={_risk_information!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _processor_information=(
            self.processor_information
            if hasattr(self, "processor_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _submit_time_utc=(
            self.submit_time_utc
            if hasattr(self, "submit_time_utc")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _risk_information=(
            self.risk_information
            if hasattr(self, "risk_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"client_reference_information={_client_reference_information!s}, "
            f"processor_information={_processor_information!s}, "
            f"order_information={_order_information!s}, "
            f"payment_information={_payment_information!s}, "
            f"processing_information={_processing_information!s}, "
            f"buyer_information={_buyer_information!s}, "
            f"submit_time_utc={_submit_time_utc!s}, "
            f"status={_status!s}, "
            f"reconciliation_id={_reconciliation_id!s}, "
            f"risk_information={_risk_information!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
