"""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_2 import (
    AmountDetails2,
)
from visaacceptancemergedspec.models.bill_to_1 import (
    BillTo1,
)
from visaacceptancemergedspec.models.invoice_details_2 import (
    InvoiceDetails2,
)
from visaacceptancemergedspec.models.reward_points_details import (
    RewardPointsDetails,
)
from visaacceptancemergedspec.models.ship_to_1 import (
    ShipTo1,
)


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

    Attributes:
        amount_details (AmountDetails2): The model property of type AmountDetails2.
        invoice_details (InvoiceDetails2): The model property of type InvoiceDetails2.
        reward_points_details (RewardPointsDetails): The model property of type
            RewardPointsDetails.
        bill_to (BillTo1): The model property of type BillTo1.
        ship_to (ShipTo1): The model property of type ShipTo1.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "amount_details": "amountDetails",
        "invoice_details": "invoiceDetails",
        "reward_points_details": "rewardPointsDetails",
        "bill_to": "billTo",
        "ship_to": "shipTo",
    }

    _optionals = [
        "amount_details",
        "invoice_details",
        "reward_points_details",
        "bill_to",
        "ship_to",
    ]

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

        # 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
        amount_details =\
            AmountDetails2.from_dictionary(
                dictionary.get("amountDetails"))\
                if "amountDetails" in dictionary.keys()\
                else APIHelper.SKIP
        invoice_details =\
            InvoiceDetails2.from_dictionary(
                dictionary.get("invoiceDetails"))\
                if "invoiceDetails" in dictionary.keys()\
                else APIHelper.SKIP
        reward_points_details =\
            RewardPointsDetails.from_dictionary(
                dictionary.get("rewardPointsDetails"))\
                if "rewardPointsDetails" in dictionary.keys()\
                else APIHelper.SKIP
        bill_to =\
            BillTo1.from_dictionary(
                dictionary.get("billTo"))\
                if "billTo" in dictionary.keys()\
                else APIHelper.SKIP
        ship_to =\
            ShipTo1.from_dictionary(
                dictionary.get("shipTo"))\
                if "shipTo" 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(amount_details,
                   invoice_details,
                   reward_points_details,
                   bill_to,
                   ship_to,
                   additional_properties)

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

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