"""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.rental_address import (
    RentalAddress,
)
from visaacceptancemergedspec.models.return_address import (
    ReturnAddress,
)


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

    Attributes:
        company_name (str): Merchant to send their auto rental company name
        affiliate_name (str): When merchant wants to send the affiliate name.
        rental_address (RentalAddress): The model property of type RentalAddress.
        return_address (ReturnAddress): The model property of type ReturnAddress.
        return_date_time (str): Date/time the auto was returned to the rental agency.
            Format: ``yyyy-MM-dd HH-mm-ss z`` This field is supported for Visa,
            MasterCard, and American Express.
        rental_date_time (str): Date/time the auto was picked up from the rental
            agency. Format: `yyyy-MM-dd HH-mm-ss z` This field is supported for Visa,
            MasterCard, and American Express.
        customer_name (str): Name of the individual making the rental agreement.
            Valid data lengths by card:  |Card Specific
            Validation|VISA|MasterCard|Discover|AMEX| |--- |--- |--- |--- | | Filed
            Length| 40| 40| 29| 26| | Field Type| AN| ANS| AN| AN| | M/O/C| O| M| M|
            M|
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "company_name": "companyName",
        "affiliate_name": "affiliateName",
        "rental_address": "rentalAddress",
        "return_address": "returnAddress",
        "return_date_time": "returnDateTime",
        "rental_date_time": "rentalDateTime",
        "customer_name": "customerName",
    }

    _optionals = [
        "company_name",
        "affiliate_name",
        "rental_address",
        "return_address",
        "return_date_time",
        "rental_date_time",
        "customer_name",
    ]

    def __init__(
        self,
        company_name=APIHelper.SKIP,
        affiliate_name=APIHelper.SKIP,
        rental_address=APIHelper.SKIP,
        return_address=APIHelper.SKIP,
        return_date_time=APIHelper.SKIP,
        rental_date_time=APIHelper.SKIP,
        customer_name=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a AutoRental5 instance."""
        # Initialize members of the class
        if company_name is not APIHelper.SKIP:
            self.company_name = company_name
        if affiliate_name is not APIHelper.SKIP:
            self.affiliate_name = affiliate_name
        if rental_address is not APIHelper.SKIP:
            self.rental_address = rental_address
        if return_address is not APIHelper.SKIP:
            self.return_address = return_address
        if return_date_time is not APIHelper.SKIP:
            self.return_date_time = return_date_time
        if rental_date_time is not APIHelper.SKIP:
            self.rental_date_time = rental_date_time
        if customer_name is not APIHelper.SKIP:
            self.customer_name = customer_name

        # 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
        company_name =\
            dictionary.get("companyName")\
            if dictionary.get("companyName")\
                else APIHelper.SKIP
        affiliate_name =\
            dictionary.get("affiliateName")\
            if dictionary.get("affiliateName")\
                else APIHelper.SKIP
        rental_address =\
            RentalAddress.from_dictionary(
                dictionary.get("rentalAddress"))\
                if "rentalAddress" in dictionary.keys()\
                else APIHelper.SKIP
        return_address =\
            ReturnAddress.from_dictionary(
                dictionary.get("returnAddress"))\
                if "returnAddress" in dictionary.keys()\
                else APIHelper.SKIP
        return_date_time =\
            dictionary.get("returnDateTime")\
            if dictionary.get("returnDateTime")\
                else APIHelper.SKIP
        rental_date_time =\
            dictionary.get("rentalDateTime")\
            if dictionary.get("rentalDateTime")\
                else APIHelper.SKIP
        customer_name =\
            dictionary.get("customerName")\
            if dictionary.get("customerName")\
                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(company_name,
                   affiliate_name,
                   rental_address,
                   return_address,
                   return_date_time,
                   rental_date_time,
                   customer_name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _company_name=(
            self.company_name
            if hasattr(self, "company_name")
            else None
        )
        _affiliate_name=(
            self.affiliate_name
            if hasattr(self, "affiliate_name")
            else None
        )
        _rental_address=(
            self.rental_address
            if hasattr(self, "rental_address")
            else None
        )
        _return_address=(
            self.return_address
            if hasattr(self, "return_address")
            else None
        )
        _return_date_time=(
            self.return_date_time
            if hasattr(self, "return_date_time")
            else None
        )
        _rental_date_time=(
            self.rental_date_time
            if hasattr(self, "rental_date_time")
            else None
        )
        _customer_name=(
            self.customer_name
            if hasattr(self, "customer_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"company_name={_company_name!r}, "
            f"affiliate_name={_affiliate_name!r}, "
            f"rental_address={_rental_address!r}, "
            f"return_address={_return_address!r}, "
            f"return_date_time={_return_date_time!r}, "
            f"rental_date_time={_rental_date_time!r}, "
            f"customer_name={_customer_name!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _company_name=(
            self.company_name
            if hasattr(self, "company_name")
            else None
        )
        _affiliate_name=(
            self.affiliate_name
            if hasattr(self, "affiliate_name")
            else None
        )
        _rental_address=(
            self.rental_address
            if hasattr(self, "rental_address")
            else None
        )
        _return_address=(
            self.return_address
            if hasattr(self, "return_address")
            else None
        )
        _return_date_time=(
            self.return_date_time
            if hasattr(self, "return_date_time")
            else None
        )
        _rental_date_time=(
            self.rental_date_time
            if hasattr(self, "rental_date_time")
            else None
        )
        _customer_name=(
            self.customer_name
            if hasattr(self, "customer_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"company_name={_company_name!s}, "
            f"affiliate_name={_affiliate_name!s}, "
            f"rental_address={_rental_address!s}, "
            f"return_address={_return_address!s}, "
            f"return_date_time={_return_date_time!s}, "
            f"rental_date_time={_rental_date_time!s}, "
            f"customer_name={_customer_name!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
