"""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.actual_final_destination import (
    ActualFinalDestination,
)
from visaacceptancemergedspec.models.first_departure import (
    FirstDeparture,
)
from visaacceptancemergedspec.models.first_destination import (
    FirstDestination,
)
from visaacceptancemergedspec.models.last_destination import (
    LastDestination,
)


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

    Attributes:
        actual_final_destination (ActualFinalDestination): The model property of type
            ActualFinalDestination.
        first_departure (FirstDeparture): The model property of type FirstDeparture.
        first_destination (FirstDestination): The model property of type
            FirstDestination.
        last_destination (LastDestination): The model property of type
            LastDestination.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "actual_final_destination": "actualFinalDestination",
        "first_departure": "firstDeparture",
        "first_destination": "firstDestination",
        "last_destination": "lastDestination",
    }

    _optionals = [
        "actual_final_destination",
        "first_departure",
        "first_destination",
        "last_destination",
    ]

    def __init__(
        self,
        actual_final_destination=APIHelper.SKIP,
        first_departure=APIHelper.SKIP,
        first_destination=APIHelper.SKIP,
        last_destination=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Travel instance."""
        # Initialize members of the class
        if actual_final_destination is not APIHelper.SKIP:
            self.actual_final_destination = actual_final_destination
        if first_departure is not APIHelper.SKIP:
            self.first_departure = first_departure
        if first_destination is not APIHelper.SKIP:
            self.first_destination = first_destination
        if last_destination is not APIHelper.SKIP:
            self.last_destination = last_destination

        # 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
        actual_final_destination =\
            ActualFinalDestination.from_dictionary(
                dictionary.get("actualFinalDestination"))\
                if "actualFinalDestination" in dictionary.keys()\
                else APIHelper.SKIP
        first_departure =\
            FirstDeparture.from_dictionary(
                dictionary.get("firstDeparture"))\
                if "firstDeparture" in dictionary.keys()\
                else APIHelper.SKIP
        first_destination =\
            FirstDestination.from_dictionary(
                dictionary.get("firstDestination"))\
                if "firstDestination" in dictionary.keys()\
                else APIHelper.SKIP
        last_destination =\
            LastDestination.from_dictionary(
                dictionary.get("lastDestination"))\
                if "lastDestination" 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(actual_final_destination,
                   first_departure,
                   first_destination,
                   last_destination,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _actual_final_destination=(
            self.actual_final_destination
            if hasattr(self, "actual_final_destination")
            else None
        )
        _first_departure=(
            self.first_departure
            if hasattr(self, "first_departure")
            else None
        )
        _first_destination=(
            self.first_destination
            if hasattr(self, "first_destination")
            else None
        )
        _last_destination=(
            self.last_destination
            if hasattr(self, "last_destination")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"actual_final_destination={_actual_final_destination!r}, "
            f"first_departure={_first_departure!r}, "
            f"first_destination={_first_destination!r}, "
            f"last_destination={_last_destination!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _actual_final_destination=(
            self.actual_final_destination
            if hasattr(self, "actual_final_destination")
            else None
        )
        _first_departure=(
            self.first_departure
            if hasattr(self, "first_departure")
            else None
        )
        _first_destination=(
            self.first_destination
            if hasattr(self, "first_destination")
            else None
        )
        _last_destination=(
            self.last_destination
            if hasattr(self, "last_destination")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"actual_final_destination={_actual_final_destination!s}, "
            f"first_departure={_first_departure!s}, "
            f"first_destination={_first_destination!s}, "
            f"last_destination={_last_destination!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
