"""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.capture import (
    Capture,
)
from visaacceptancemergedspec.models.customer_1 import (
    Customer1,
)
from visaacceptancemergedspec.models.instrument_identifier_1 import (
    InstrumentIdentifier1,
)
from visaacceptancemergedspec.models.mself import (
    Self,
)
from visaacceptancemergedspec.models.payment_instrument_2 import (
    PaymentInstrument2,
)
from visaacceptancemergedspec.models.reversal_1 import (
    Reversal1,
)
from visaacceptancemergedspec.models.shipping_address_2 import (
    ShippingAddress2,
)


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

    Attributes:
        mself (Self): The model property of type Self.
        reversal (Reversal1): The model property of type Reversal1.
        capture (Capture): The model property of type Capture.
        customer (Customer1): The model property of type Customer1.
        payment_instrument (PaymentInstrument2): The model property of type
            PaymentInstrument2.
        shipping_address (ShippingAddress2): The model property of type
            ShippingAddress2.
        instrument_identifier (InstrumentIdentifier1): The model property of type
            InstrumentIdentifier1.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "mself": "self",
        "reversal": "reversal",
        "capture": "capture",
        "customer": "customer",
        "payment_instrument": "paymentInstrument",
        "shipping_address": "shippingAddress",
        "instrument_identifier": "instrumentIdentifier",
    }

    _optionals = [
        "mself",
        "reversal",
        "capture",
        "customer",
        "payment_instrument",
        "shipping_address",
        "instrument_identifier",
    ]

    def __init__(
        self,
        mself=APIHelper.SKIP,
        reversal=APIHelper.SKIP,
        capture=APIHelper.SKIP,
        customer=APIHelper.SKIP,
        payment_instrument=APIHelper.SKIP,
        shipping_address=APIHelper.SKIP,
        instrument_identifier=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Links instance."""
        # Initialize members of the class
        if mself is not APIHelper.SKIP:
            self.mself = mself
        if reversal is not APIHelper.SKIP:
            self.reversal = reversal
        if capture is not APIHelper.SKIP:
            self.capture = capture
        if customer is not APIHelper.SKIP:
            self.customer = customer
        if payment_instrument is not APIHelper.SKIP:
            self.payment_instrument = payment_instrument
        if shipping_address is not APIHelper.SKIP:
            self.shipping_address = shipping_address
        if instrument_identifier is not APIHelper.SKIP:
            self.instrument_identifier = instrument_identifier

        # 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
        mself =\
            Self.from_dictionary(
                dictionary.get("self"))\
                if "self" in dictionary.keys()\
                else APIHelper.SKIP
        reversal =\
            Reversal1.from_dictionary(
                dictionary.get("reversal"))\
                if "reversal" in dictionary.keys()\
                else APIHelper.SKIP
        capture =\
            Capture.from_dictionary(
                dictionary.get("capture"))\
                if "capture" in dictionary.keys()\
                else APIHelper.SKIP
        customer =\
            Customer1.from_dictionary(
                dictionary.get("customer"))\
                if "customer" in dictionary.keys()\
                else APIHelper.SKIP
        payment_instrument =\
            PaymentInstrument2.from_dictionary(
                dictionary.get("paymentInstrument"))\
                if "paymentInstrument" in dictionary.keys()\
                else APIHelper.SKIP
        shipping_address =\
            ShippingAddress2.from_dictionary(
                dictionary.get("shippingAddress"))\
                if "shippingAddress" in dictionary.keys()\
                else APIHelper.SKIP
        instrument_identifier =\
            InstrumentIdentifier1.from_dictionary(
                dictionary.get("instrumentIdentifier"))\
                if "instrumentIdentifier" 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(mself,
                   reversal,
                   capture,
                   customer,
                   payment_instrument,
                   shipping_address,
                   instrument_identifier,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mself=(
            self.mself
            if hasattr(self, "mself")
            else None
        )
        _reversal=(
            self.reversal
            if hasattr(self, "reversal")
            else None
        )
        _capture=(
            self.capture
            if hasattr(self, "capture")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _payment_instrument=(
            self.payment_instrument
            if hasattr(self, "payment_instrument")
            else None
        )
        _shipping_address=(
            self.shipping_address
            if hasattr(self, "shipping_address")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mself={_mself!r}, "
            f"reversal={_reversal!r}, "
            f"capture={_capture!r}, "
            f"customer={_customer!r}, "
            f"payment_instrument={_payment_instrument!r}, "
            f"shipping_address={_shipping_address!r}, "
            f"instrument_identifier={_instrument_identifier!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _mself=(
            self.mself
            if hasattr(self, "mself")
            else None
        )
        _reversal=(
            self.reversal
            if hasattr(self, "reversal")
            else None
        )
        _capture=(
            self.capture
            if hasattr(self, "capture")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _payment_instrument=(
            self.payment_instrument
            if hasattr(self, "payment_instrument")
            else None
        )
        _shipping_address=(
            self.shipping_address
            if hasattr(self, "shipping_address")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mself={_mself!s}, "
            f"reversal={_reversal!s}, "
            f"capture={_capture!s}, "
            f"customer={_customer!s}, "
            f"payment_instrument={_payment_instrument!s}, "
            f"shipping_address={_shipping_address!s}, "
            f"instrument_identifier={_instrument_identifier!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
