# coding: utf-8

"""
    Zitadel SDK

    The Zitadel SDK is a convenience wrapper around the Zitadel APIs to assist you in integrating with your Zitadel environment. This SDK enables you to handle resources, settings, and configurations within the Zitadel platform.

    The version of the OpenAPI document: 1.0.0
    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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from zitadel_client.models.oidc_service_prompt import OIDCServicePrompt
from typing import Optional, Set
from typing_extensions import Self

class OIDCServiceAuthRequest(BaseModel):
    """
    OIDCServiceAuthRequest
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, description="ID of the authorization request")
    creation_date: Optional[datetime] = Field(default=None, description="Time when the auth request was created", alias="creationDate")
    client_id: Optional[StrictStr] = Field(default=None, description="OIDC client ID of the application that created the auth request", alias="clientId")
    scope: Optional[List[StrictStr]] = Field(default=None, description="Requested scopes by the application, which the user must consent to.")
    redirect_uri: Optional[StrictStr] = Field(default=None, description="Base URI that points back to the application", alias="redirectUri")
    prompt: Optional[List[OIDCServicePrompt]] = Field(default=None, description="Prompts that must be displayed to the user")
    ui_locales: Optional[List[StrictStr]] = Field(default=None, description="End-User's preferred languages and scripts for the user interface, represented as a list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value [fr-CA, fr, en] represents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported.", alias="uiLocales")
    login_hint: Optional[StrictStr] = Field(default=None, description="Login hint can be set by the application with a user identifier such as an email or phone number.", alias="loginHint")
    max_age: Optional[StrictStr] = Field(default=None, description="Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated. If the elapsed time is greater than this value, or the field is present with 0 duration, the user must be re-authenticated.", alias="maxAge")
    hint_user_id: Optional[StrictStr] = Field(default=None, description="User ID taken from a ID Token Hint if it was present and valid.", alias="hintUserId")

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

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

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of OIDCServiceAuthRequest from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "creationDate": obj.get("creationDate"),
            "clientId": obj.get("clientId"),
            "scope": obj.get("scope"),
            "redirectUri": obj.get("redirectUri"),
            "prompt": obj.get("prompt"),
            "uiLocales": obj.get("uiLocales"),
            "loginHint": obj.get("loginHint"),
            "maxAge": obj.get("maxAge"),
            "hintUserId": obj.get("hintUserId")
        })
        return _obj


