"""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.aggregator_information_5 import (
    AggregatorInformation5,
)
from visaacceptancemergedspec.models.agreement_information_6 import (
    AgreementInformation6,
)
from visaacceptancemergedspec.models.buyer_information_6 import (
    BuyerInformation6,
)
from visaacceptancemergedspec.models.client_reference_information_28 import (
    ClientReferenceInformation28,
)
from visaacceptancemergedspec.models.consumer_authentication_information_2 import (
    ConsumerAuthenticationInformation2,
)
from visaacceptancemergedspec.models.device_information_5 import (
    DeviceInformation5,
)
from visaacceptancemergedspec.models.installment_information_4 import (
    InstallmentInformation4,
)
from visaacceptancemergedspec.models.merchant_information_11 import (
    MerchantInformation11,
)
from visaacceptancemergedspec.models.order_information_20 import (
    OrderInformation20,
)
from visaacceptancemergedspec.models.payment_information_16 import (
    PaymentInformation16,
)
from visaacceptancemergedspec.models.processing_information_19 import (
    ProcessingInformation19,
)


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

    Attributes:
        agreement_information (AgreementInformation6): The model property of type
            AgreementInformation6.
        client_reference_information (ClientReferenceInformation28): The model
            property of type ClientReferenceInformation28.
        aggregator_information (AggregatorInformation5): The model property of type
            AggregatorInformation5.
        consumer_authentication_information (ConsumerAuthenticationInformation2): The
            model property of type ConsumerAuthenticationInformation2.
        device_information (DeviceInformation5): The model property of type
            DeviceInformation5.
        installment_information (InstallmentInformation4): The model property of type
            InstallmentInformation4.
        merchant_information (MerchantInformation11): The model property of type
            MerchantInformation11.
        order_information (OrderInformation20): The model property of type
            OrderInformation20.
        payment_information (PaymentInformation16): The model property of type
            PaymentInformation16.
        processing_information (ProcessingInformation19): The model property of type
            ProcessingInformation19.
        buyer_information (BuyerInformation6): The model property of type
            BuyerInformation6.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "agreement_information": "agreementInformation",
        "client_reference_information": "clientReferenceInformation",
        "aggregator_information": "aggregatorInformation",
        "consumer_authentication_information": "consumerAuthenticationInformation",
        "device_information": "deviceInformation",
        "installment_information": "installmentInformation",
        "merchant_information": "merchantInformation",
        "order_information": "orderInformation",
        "payment_information": "paymentInformation",
        "processing_information": "processingInformation",
        "buyer_information": "buyerInformation",
    }

    _optionals = [
        "agreement_information",
        "client_reference_information",
        "aggregator_information",
        "consumer_authentication_information",
        "device_information",
        "installment_information",
        "merchant_information",
        "order_information",
        "payment_information",
        "processing_information",
        "buyer_information",
    ]

    def __init__(
        self,
        agreement_information=APIHelper.SKIP,
        client_reference_information=APIHelper.SKIP,
        aggregator_information=APIHelper.SKIP,
        consumer_authentication_information=APIHelper.SKIP,
        device_information=APIHelper.SKIP,
        installment_information=APIHelper.SKIP,
        merchant_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        buyer_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a CreateBillingAgreement instance."""
        # Initialize members of the class
        if agreement_information is not APIHelper.SKIP:
            self.agreement_information = agreement_information
        if client_reference_information is not APIHelper.SKIP:
            self.client_reference_information = client_reference_information
        if aggregator_information is not APIHelper.SKIP:
            self.aggregator_information = aggregator_information
        if consumer_authentication_information is not APIHelper.SKIP:
            self.consumer_authentication_information =\
                 consumer_authentication_information
        if device_information is not APIHelper.SKIP:
            self.device_information = device_information
        if installment_information is not APIHelper.SKIP:
            self.installment_information = installment_information
        if merchant_information is not APIHelper.SKIP:
            self.merchant_information = merchant_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

        # 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
        agreement_information =\
            AgreementInformation6.from_dictionary(
                dictionary.get("agreementInformation"))\
                if "agreementInformation" in dictionary.keys()\
                else APIHelper.SKIP
        client_reference_information =\
            ClientReferenceInformation28.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        aggregator_information =\
            AggregatorInformation5.from_dictionary(
                dictionary.get("aggregatorInformation"))\
                if "aggregatorInformation" in dictionary.keys()\
                else APIHelper.SKIP
        consumer_authentication_information =\
            ConsumerAuthenticationInformation2.from_dictionary(
                dictionary.get("consumerAuthenticationInformation"))\
                if "consumerAuthenticationInformation" in dictionary.keys()\
                else APIHelper.SKIP
        device_information =\
            DeviceInformation5.from_dictionary(
                dictionary.get("deviceInformation"))\
                if "deviceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        installment_information =\
            InstallmentInformation4.from_dictionary(
                dictionary.get("installmentInformation"))\
                if "installmentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        merchant_information =\
            MerchantInformation11.from_dictionary(
                dictionary.get("merchantInformation"))\
                if "merchantInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation20.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation16.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            ProcessingInformation19.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        buyer_information =\
            BuyerInformation6.from_dictionary(
                dictionary.get("buyerInformation"))\
                if "buyerInformation" 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(agreement_information,
                   client_reference_information,
                   aggregator_information,
                   consumer_authentication_information,
                   device_information,
                   installment_information,
                   merchant_information,
                   order_information,
                   payment_information,
                   processing_information,
                   buyer_information,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _agreement_information=(
            self.agreement_information
            if hasattr(self, "agreement_information")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _aggregator_information=(
            self.aggregator_information
            if hasattr(self, "aggregator_information")
            else None
        )
        _consumer_authentication_information=(
            self.consumer_authentication_information
            if hasattr(self, "consumer_authentication_information")
            else None
        )
        _device_information=(
            self.device_information
            if hasattr(self, "device_information")
            else None
        )
        _installment_information=(
            self.installment_information
            if hasattr(self, "installment_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_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
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"agreement_information={_agreement_information!r}, "
            f"client_reference_information={_client_reference_information!r}, "
            f"aggregator_information={_aggregator_information!r}, "
            f"consumer_authentication_information={_consumer_authentication_information!r}, "
            f"device_information={_device_information!r}, "
            f"installment_information={_installment_information!r}, "
            f"merchant_information={_merchant_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"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _agreement_information=(
            self.agreement_information
            if hasattr(self, "agreement_information")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _aggregator_information=(
            self.aggregator_information
            if hasattr(self, "aggregator_information")
            else None
        )
        _consumer_authentication_information=(
            self.consumer_authentication_information
            if hasattr(self, "consumer_authentication_information")
            else None
        )
        _device_information=(
            self.device_information
            if hasattr(self, "device_information")
            else None
        )
        _installment_information=(
            self.installment_information
            if hasattr(self, "installment_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_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
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"agreement_information={_agreement_information!s}, "
            f"client_reference_information={_client_reference_information!s}, "
            f"aggregator_information={_aggregator_information!s}, "
            f"consumer_authentication_information={_consumer_authentication_information!s}, "
            f"device_information={_device_information!s}, "
            f"installment_information={_installment_information!s}, "
            f"merchant_information={_merchant_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"additional_properties={_additional_properties!s}, "
            f")"
        )
