"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


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

    A vehicle that is being rented from an automobile rental company.

    Attributes:
        description (str): The model property of type str.
        vehicle_type (str): The model property of type str.
        manufacturer (str): The model property of type str.
        model (str): The model property of type str.
        num_doors (int): Number of doors the vehicle has.
        passenger_capacity (int): Number of passengers (excluding driver) that the
            vehicle can hold.  > Example: A four seat car can hold 3 passengers.
        airconditioned (bool): If vehicle has air conditioning.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "description": "description",
        "vehicle_type": "vehicleType",
        "manufacturer": "manufacturer",
        "model": "model",
        "num_doors": "numDoors",
        "passenger_capacity": "passengerCapacity",
        "airconditioned": "airconditioned",
    }

    _optionals = [
        "vehicle_type",
        "manufacturer",
        "model",
        "num_doors",
        "passenger_capacity",
        "airconditioned",
    ]

    def __init__(
        self,
        description=None,
        vehicle_type=APIHelper.SKIP,
        manufacturer=APIHelper.SKIP,
        model=APIHelper.SKIP,
        num_doors=APIHelper.SKIP,
        passenger_capacity=APIHelper.SKIP,
        airconditioned=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Vehicle instance."""
        # Initialize members of the class
        self.description = description
        if vehicle_type is not APIHelper.SKIP:
            self.vehicle_type = vehicle_type
        if manufacturer is not APIHelper.SKIP:
            self.manufacturer = manufacturer
        if model is not APIHelper.SKIP:
            self.model = model
        if num_doors is not APIHelper.SKIP:
            self.num_doors = num_doors
        if passenger_capacity is not APIHelper.SKIP:
            self.passenger_capacity = passenger_capacity
        if airconditioned is not APIHelper.SKIP:
            self.airconditioned = airconditioned

        # 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
        description =\
            dictionary.get("description")\
            if dictionary.get("description")\
                else None
        vehicle_type =\
            dictionary.get("vehicleType")\
            if dictionary.get("vehicleType")\
                else APIHelper.SKIP
        manufacturer =\
            dictionary.get("manufacturer")\
            if dictionary.get("manufacturer")\
                else APIHelper.SKIP
        model =\
            dictionary.get("model")\
            if dictionary.get("model")\
                else APIHelper.SKIP
        num_doors =\
            dictionary.get("numDoors")\
            if dictionary.get("numDoors")\
                else APIHelper.SKIP
        passenger_capacity =\
            dictionary.get("passengerCapacity")\
            if dictionary.get("passengerCapacity")\
                else APIHelper.SKIP
        airconditioned =\
            dictionary.get("airconditioned")\
            if "airconditioned" 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(description,
                   vehicle_type,
                   manufacturer,
                   model,
                   num_doors,
                   passenger_capacity,
                   airconditioned,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _description=self.description
        _vehicle_type=(
            self.vehicle_type
            if hasattr(self, "vehicle_type")
            else None
        )
        _manufacturer=(
            self.manufacturer
            if hasattr(self, "manufacturer")
            else None
        )
        _model=(
            self.model
            if hasattr(self, "model")
            else None
        )
        _num_doors=(
            self.num_doors
            if hasattr(self, "num_doors")
            else None
        )
        _passenger_capacity=(
            self.passenger_capacity
            if hasattr(self, "passenger_capacity")
            else None
        )
        _airconditioned=(
            self.airconditioned
            if hasattr(self, "airconditioned")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"description={_description!r}, "
            f"vehicle_type={_vehicle_type!r}, "
            f"manufacturer={_manufacturer!r}, "
            f"model={_model!r}, "
            f"num_doors={_num_doors!r}, "
            f"passenger_capacity={_passenger_capacity!r}, "
            f"airconditioned={_airconditioned!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _description=self.description
        _vehicle_type=(
            self.vehicle_type
            if hasattr(self, "vehicle_type")
            else None
        )
        _manufacturer=(
            self.manufacturer
            if hasattr(self, "manufacturer")
            else None
        )
        _model=(
            self.model
            if hasattr(self, "model")
            else None
        )
        _num_doors=(
            self.num_doors
            if hasattr(self, "num_doors")
            else None
        )
        _passenger_capacity=(
            self.passenger_capacity
            if hasattr(self, "passenger_capacity")
            else None
        )
        _airconditioned=(
            self.airconditioned
            if hasattr(self, "airconditioned")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"description={_description!s}, "
            f"vehicle_type={_vehicle_type!s}, "
            f"manufacturer={_manufacturer!s}, "
            f"model={_model!s}, "
            f"num_doors={_num_doors!s}, "
            f"passenger_capacity={_passenger_capacity!s}, "
            f"airconditioned={_airconditioned!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
