# coding: utf-8

"""
    Iam

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.0
    Contact: info@affinidi.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr

class ConsumerAuthTokenEndpointOutput(BaseModel):
    """
    ConsumerAuthTokenEndpointOutput
    """
    access_token: Optional[StrictStr] = Field(default=None, description="The access token issued by the authorization server.")
    expires_in: Optional[StrictInt] = Field(default=None, description="The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the access token will expire in one hour from the time the response was generated.")
    id_token: Optional[StrictInt] = Field(default=None, description="To retrieve a refresh token request the id_token scope.")
    refresh_token: Optional[StrictStr] = Field(default=None, description="The refresh token, which can be used to obtain new access tokens. To retrieve it add the scope \"offline\" to your access token request.")
    scope: Optional[StrictStr] = Field(default=None, description="The scope of the access token")
    token_type: Optional[StrictStr] = Field(default=None, description="The type of the token issued")
    __properties = ["access_token", "expires_in", "id_token", "refresh_token", "scope", "token_type"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> ConsumerAuthTokenEndpointOutput:
        """Create an instance of ConsumerAuthTokenEndpointOutput from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> ConsumerAuthTokenEndpointOutput:
        """Create an instance of ConsumerAuthTokenEndpointOutput from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return ConsumerAuthTokenEndpointOutput.parse_obj(obj)

        _obj = ConsumerAuthTokenEndpointOutput.parse_obj({
            "access_token": obj.get("access_token"),
            "expires_in": obj.get("expires_in"),
            "id_token": obj.get("id_token"),
            "refresh_token": obj.get("refresh_token"),
            "scope": obj.get("scope"),
            "token_type": obj.get("token_type")
        })
        return _obj


