"""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.amount_details_27 import (
    AmountDetails27,
)
from visaacceptancemergedspec.models.bill_to_11 import (
    BillTo11,
)
from visaacceptancemergedspec.models.ship_to_8 import (
    ShipTo8,
)
from visaacceptancemergedspec.models.shipping_details_5 import (
    ShippingDetails5,
)


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

    Attributes:
        bill_to (BillTo11): The model property of type BillTo11.
        ship_to (ShipTo8): The model property of type ShipTo8.
        amount_details (AmountDetails27): The model property of type AmountDetails27.
        shipping_details (ShippingDetails5): The model property of type
            ShippingDetails5.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "bill_to": "billTo",
        "ship_to": "shipTo",
        "amount_details": "amountDetails",
        "shipping_details": "shippingDetails",
    }

    _optionals = [
        "bill_to",
        "ship_to",
        "amount_details",
        "shipping_details",
    ]

    def __init__(
        self,
        bill_to=APIHelper.SKIP,
        ship_to=APIHelper.SKIP,
        amount_details=APIHelper.SKIP,
        shipping_details=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a OrderInformation25 instance."""
        # Initialize members of the class
        if bill_to is not APIHelper.SKIP:
            self.bill_to = bill_to
        if ship_to is not APIHelper.SKIP:
            self.ship_to = ship_to
        if amount_details is not APIHelper.SKIP:
            self.amount_details = amount_details
        if shipping_details is not APIHelper.SKIP:
            self.shipping_details = shipping_details

        # 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
        bill_to =\
            BillTo11.from_dictionary(
                dictionary.get("billTo"))\
                if "billTo" in dictionary.keys()\
                else APIHelper.SKIP
        ship_to =\
            ShipTo8.from_dictionary(
                dictionary.get("shipTo"))\
                if "shipTo" in dictionary.keys()\
                else APIHelper.SKIP
        amount_details =\
            AmountDetails27.from_dictionary(
                dictionary.get("amountDetails"))\
                if "amountDetails" in dictionary.keys()\
                else APIHelper.SKIP
        shipping_details =\
            ShippingDetails5.from_dictionary(
                dictionary.get("shippingDetails"))\
                if "shippingDetails" 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(bill_to,
                   ship_to,
                   amount_details,
                   shipping_details,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _bill_to=(
            self.bill_to
            if hasattr(self, "bill_to")
            else None
        )
        _ship_to=(
            self.ship_to
            if hasattr(self, "ship_to")
            else None
        )
        _amount_details=(
            self.amount_details
            if hasattr(self, "amount_details")
            else None
        )
        _shipping_details=(
            self.shipping_details
            if hasattr(self, "shipping_details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"bill_to={_bill_to!r}, "
            f"ship_to={_ship_to!r}, "
            f"amount_details={_amount_details!r}, "
            f"shipping_details={_shipping_details!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _bill_to=(
            self.bill_to
            if hasattr(self, "bill_to")
            else None
        )
        _ship_to=(
            self.ship_to
            if hasattr(self, "ship_to")
            else None
        )
        _amount_details=(
            self.amount_details
            if hasattr(self, "amount_details")
            else None
        )
        _shipping_details=(
            self.shipping_details
            if hasattr(self, "shipping_details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"bill_to={_bill_to!s}, "
            f"ship_to={_ship_to!s}, "
            f"amount_details={_amount_details!s}, "
            f"shipping_details={_shipping_details!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
