"""cellpointapi.

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

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


class TokenPost200Response(object):
    """Implementation of the 'Token.POST.200.Response' model.

    Response object for a successful token request.

    Attributes:
        access_token (str): JWT access token with the allowed scope.  Token should be
            used as the value in `Authorization: Bearer TOKEN_HERE` request headers
            for future API calls.
        scope (str): Scope of access for the token.
        expires_in (int): How long the token is valid in seconds.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "access_token": "accessToken",
        "scope": "scope",
        "expires_in": "expiresIn",
    }

    _optionals = [
        "scope",
        "expires_in",
    ]

    def __init__(
        self,
        access_token=None,
        scope=APIHelper.SKIP,
        expires_in=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a TokenPost200Response instance."""
        # Initialize members of the class
        self.access_token = access_token
        if scope is not APIHelper.SKIP:
            self.scope = scope
        if expires_in is not APIHelper.SKIP:
            self.expires_in = expires_in

        # 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
        access_token =\
            dictionary.get("accessToken")\
            if dictionary.get("accessToken")\
                else None
        scope =\
            dictionary.get("scope")\
            if dictionary.get("scope")\
                else APIHelper.SKIP
        expires_in =\
            dictionary.get("expiresIn")\
            if dictionary.get("expiresIn")\
                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(access_token,
                   scope,
                   expires_in,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _access_token=self.access_token
        _scope=(
            self.scope
            if hasattr(self, "scope")
            else None
        )
        _expires_in=(
            self.expires_in
            if hasattr(self, "expires_in")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"access_token={_access_token!r}, "
            f"scope={_scope!r}, "
            f"expires_in={_expires_in!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _access_token=self.access_token
        _scope=(
            self.scope
            if hasattr(self, "scope")
            else None
        )
        _expires_in=(
            self.expires_in
            if hasattr(self, "expires_in")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"access_token={_access_token!s}, "
            f"scope={_scope!s}, "
            f"expires_in={_expires_in!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
