"""cellpointapi.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.location import Location


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

    Activity that is being purchased, such as tickets to an event.

    Attributes:
        language (str): Language (ISO 639-1) code of the language that the activity
            will be in.
        activity_type (str): Type of activity.  Options are: - comedy - concert -
            sports - theater
        location (Location): Details about a particular location.
        supplier_name (str): Name of company supplying this activity.
        start_time (datetime): Planned start time of the activity.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "start_time": "startTime",
        "language": "language",
        "activity_type": "activityType",
        "location": "location",
        "supplier_name": "supplierName",
    }

    _optionals = [
        "language",
        "activity_type",
        "location",
        "supplier_name",
    ]

    def __init__(
        self,
        start_time=None,
        language=APIHelper.SKIP,
        activity_type=APIHelper.SKIP,
        location=APIHelper.SKIP,
        supplier_name=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ActivityData instance."""
        # Initialize members of the class
        if language is not APIHelper.SKIP:
            self.language = language
        if activity_type is not APIHelper.SKIP:
            self.activity_type = activity_type
        if location is not APIHelper.SKIP:
            self.location = location
        if supplier_name is not APIHelper.SKIP:
            self.supplier_name = supplier_name
        self.start_time =\
             APIHelper.apply_datetime_converter(
            start_time, APIHelper.RFC3339DateTime)\
             if start_time else None

        # 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
        start_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("startTime")).datetime\
            if dictionary.get("startTime") else None
        language =\
            dictionary.get("language")\
            if dictionary.get("language")\
                else APIHelper.SKIP
        activity_type =\
            dictionary.get("activityType")\
            if dictionary.get("activityType")\
                else APIHelper.SKIP
        location =\
            Location.from_dictionary(
                dictionary.get("location"))\
                if "location" in dictionary.keys()\
                else APIHelper.SKIP
        supplier_name =\
            dictionary.get("supplierName")\
            if dictionary.get("supplierName")\
                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(start_time,
                   language,
                   activity_type,
                   location,
                   supplier_name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _activity_type=(
            self.activity_type
            if hasattr(self, "activity_type")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _supplier_name=(
            self.supplier_name
            if hasattr(self, "supplier_name")
            else None
        )
        _start_time=self.start_time
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"language={_language!r}, "
            f"activity_type={_activity_type!r}, "
            f"location={_location!r}, "
            f"supplier_name={_supplier_name!r}, "
            f"start_time={_start_time!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _activity_type=(
            self.activity_type
            if hasattr(self, "activity_type")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _supplier_name=(
            self.supplier_name
            if hasattr(self, "supplier_name")
            else None
        )
        _start_time=self.start_time
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"language={_language!s}, "
            f"activity_type={_activity_type!s}, "
            f"location={_location!s}, "
            f"supplier_name={_supplier_name!s}, "
            f"start_time={_start_time!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
