"""cellpointapi.

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

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


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

    Defines the requested permissions for the client.

    Attributes:
        grant_type (str): The type of grant requested. This must be
            `client_credentials`.
        client_assertion_type (str): The type of client assertion. This must be
            `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`.
        client_id (str): The client ID, as provided by Cellpoint.
        audience (Audience): The intended audience for the client assertion.
        scope (str): The requested permissions for the client. A space separated list
            of permissions.
        client_assertion (str): A JWT signed by the caller. The JWT must contain the
            following claims: - `iss`: The client ID, as provided by Cellpoint. -
            `sub`: The client ID, as provided by Cellpoint. - `aud`: The appropriate
            auth server, example: https://auth.api.test.cellpoint.app/
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "grant_type": "grant_type",
        "client_assertion_type": "client_assertion_type",
        "client_id": "client_id",
        "audience": "audience",
        "scope": "scope",
        "client_assertion": "client_assertion",
    }

    _optionals = [
        "grant_type",
        "client_assertion_type",
        "client_id",
        "audience",
        "scope",
        "client_assertion",
    ]

    def __init__(
        self,
        grant_type=APIHelper.SKIP,
        client_assertion_type=APIHelper.SKIP,
        client_id=APIHelper.SKIP,
        audience=APIHelper.SKIP,
        scope=APIHelper.SKIP,
        client_assertion=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ClientAssertion instance."""
        # Initialize members of the class
        if grant_type is not APIHelper.SKIP:
            self.grant_type = grant_type
        if client_assertion_type is not APIHelper.SKIP:
            self.client_assertion_type = client_assertion_type
        if client_id is not APIHelper.SKIP:
            self.client_id = client_id
        if audience is not APIHelper.SKIP:
            self.audience = audience
        if scope is not APIHelper.SKIP:
            self.scope = scope
        if client_assertion is not APIHelper.SKIP:
            self.client_assertion = client_assertion

        # 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
        grant_type =\
            dictionary.get("grant_type")\
            if dictionary.get("grant_type")\
                else APIHelper.SKIP
        client_assertion_type =\
            dictionary.get("client_assertion_type")\
            if dictionary.get("client_assertion_type")\
                else APIHelper.SKIP
        client_id =\
            dictionary.get("client_id")\
            if dictionary.get("client_id")\
                else APIHelper.SKIP
        audience =\
            dictionary.get("audience")\
            if dictionary.get("audience")\
                else APIHelper.SKIP
        scope =\
            dictionary.get("scope")\
            if dictionary.get("scope")\
                else APIHelper.SKIP
        client_assertion =\
            dictionary.get("client_assertion")\
            if dictionary.get("client_assertion")\
                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(grant_type,
                   client_assertion_type,
                   client_id,
                   audience,
                   scope,
                   client_assertion,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _grant_type=(
            self.grant_type
            if hasattr(self, "grant_type")
            else None
        )
        _client_assertion_type=(
            self.client_assertion_type
            if hasattr(self, "client_assertion_type")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _audience=(
            self.audience
            if hasattr(self, "audience")
            else None
        )
        _scope=(
            self.scope
            if hasattr(self, "scope")
            else None
        )
        _client_assertion=(
            self.client_assertion
            if hasattr(self, "client_assertion")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"grant_type={_grant_type!r}, "
            f"client_assertion_type={_client_assertion_type!r}, "
            f"client_id={_client_id!r}, "
            f"audience={_audience!r}, "
            f"scope={_scope!r}, "
            f"client_assertion={_client_assertion!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _grant_type=(
            self.grant_type
            if hasattr(self, "grant_type")
            else None
        )
        _client_assertion_type=(
            self.client_assertion_type
            if hasattr(self, "client_assertion_type")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _audience=(
            self.audience
            if hasattr(self, "audience")
            else None
        )
        _scope=(
            self.scope
            if hasattr(self, "scope")
            else None
        )
        _client_assertion=(
            self.client_assertion
            if hasattr(self, "client_assertion")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"grant_type={_grant_type!s}, "
            f"client_assertion_type={_client_assertion_type!s}, "
            f"client_id={_client_id!s}, "
            f"audience={_audience!s}, "
            f"scope={_scope!s}, "
            f"client_assertion={_client_assertion!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
