"""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.airline_industry_data import (
    AirlineIndustryData,
)
from cellpointapi.models.auto_rental_industry_data import (
    AutoRentalIndustryData,
)
from cellpointapi.models.lodging_industry_data import (
    LodgingIndustryData,
)


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

    Industry specific data required based on agreements between merchant and
    acquirers and for fraud detection.

    Attributes:
        airline_data (List[AirlineIndustryData]): The model property of type
            List[AirlineIndustryData].
        lodging_data (List[LodgingIndustryData]): The model property of type
            List[LodgingIndustryData].
        auto_rental_data (List[AutoRentalIndustryData]): The model property of type
            List[AutoRentalIndustryData].
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "airline_data": "airlineData",
        "lodging_data": "lodgingData",
        "auto_rental_data": "autoRentalData",
    }

    _optionals = [
        "airline_data",
        "lodging_data",
        "auto_rental_data",
    ]

    def __init__(
        self,
        airline_data=APIHelper.SKIP,
        lodging_data=APIHelper.SKIP,
        auto_rental_data=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a IndustryData instance."""
        # Initialize members of the class
        if airline_data is not APIHelper.SKIP:
            self.airline_data = airline_data
        if lodging_data is not APIHelper.SKIP:
            self.lodging_data = lodging_data
        if auto_rental_data is not APIHelper.SKIP:
            self.auto_rental_data = auto_rental_data

        # 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
        airline_data = None
        if dictionary.get("airlineData") is not None:
            airline_data = [
                AirlineIndustryData.from_dictionary(x)
                    for x in dictionary.get("airlineData")
            ]
        else:
            airline_data = APIHelper.SKIP
        lodging_data = None
        if dictionary.get("lodgingData") is not None:
            lodging_data = [
                LodgingIndustryData.from_dictionary(x)
                    for x in dictionary.get("lodgingData")
            ]
        else:
            lodging_data = APIHelper.SKIP
        auto_rental_data = None
        if dictionary.get("autoRentalData") is not None:
            auto_rental_data = [
                AutoRentalIndustryData.from_dictionary(x)
                    for x in dictionary.get("autoRentalData")
            ]
        else:
            auto_rental_data = 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(airline_data,
                   lodging_data,
                   auto_rental_data,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _airline_data=(
            self.airline_data
            if hasattr(self, "airline_data")
            else None
        )
        _lodging_data=(
            self.lodging_data
            if hasattr(self, "lodging_data")
            else None
        )
        _auto_rental_data=(
            self.auto_rental_data
            if hasattr(self, "auto_rental_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"airline_data={_airline_data!r}, "
            f"lodging_data={_lodging_data!r}, "
            f"auto_rental_data={_auto_rental_data!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _airline_data=(
            self.airline_data
            if hasattr(self, "airline_data")
            else None
        )
        _lodging_data=(
            self.lodging_data
            if hasattr(self, "lodging_data")
            else None
        )
        _auto_rental_data=(
            self.auto_rental_data
            if hasattr(self, "auto_rental_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"airline_data={_airline_data!s}, "
            f"lodging_data={_lodging_data!s}, "
            f"auto_rental_data={_auto_rental_data!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
