# coding: utf-8

"""
    HashiCorp Vault API

    HTTP API that gives you full access to Vault. All API routes are prefixed with `/v1/`.

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

class JwtConfigureRequest(BaseModel):
    """
    JwtConfigureRequest
    """ # noqa: E501
    bound_issuer: Optional[StrictStr] = Field(default=None, description="The value against which to match the 'iss' claim in a JWT. Optional.")
    default_role: Optional[StrictStr] = Field(default=None, description="The default role to use if none is provided during login. If not set, a role is required during login.")
    jwks_ca_pem: Optional[StrictStr] = Field(default=None, description="The CA certificate or chain of certificates, in PEM format, to use to validate connections to the JWKS URL. If not set, system certificates are used.")
    jwks_url: Optional[StrictStr] = Field(default=None, description="JWKS URL to use to authenticate signatures. Cannot be used with \"oidc_discovery_url\" or \"jwt_validation_pubkeys\".")
    jwt_supported_algs: Optional[List[StrictStr]] = Field(default=None, description="A list of supported signing algorithms. Defaults to RS256.")
    jwt_validation_pubkeys: Optional[List[StrictStr]] = Field(default=None, description="A list of PEM-encoded public keys to use to authenticate signatures locally. Cannot be used with \"jwks_url\" or \"oidc_discovery_url\".")
    namespace_in_state: Optional[StrictBool] = Field(default=None, description="Pass namespace in the OIDC state parameter instead of as a separate query parameter. With this setting, the allowed redirect URL(s) in Vault and on the provider side should not contain a namespace query parameter. This means only one redirect URL entry needs to be maintained on the provider side for all vault namespaces that will be authenticating against it. Defaults to true for new configs.")
    oidc_client_id: Optional[StrictStr] = Field(default=None, description="The OAuth Client ID configured with your OIDC provider.")
    oidc_client_secret: Optional[StrictStr] = Field(default=None, description="The OAuth Client Secret configured with your OIDC provider.")
    oidc_discovery_ca_pem: Optional[StrictStr] = Field(default=None, description="The CA certificate or chain of certificates, in PEM format, to use to validate connections to the OIDC Discovery URL. If not set, system certificates are used.")
    oidc_discovery_url: Optional[StrictStr] = Field(default=None, description="OIDC Discovery URL, without any .well-known component (base path). Cannot be used with \"jwks_url\" or \"jwt_validation_pubkeys\".")
    oidc_response_mode: Optional[StrictStr] = Field(default=None, description="The response mode to be used in the OAuth2 request. Allowed values are 'query' and 'form_post'.")
    oidc_response_types: Optional[List[StrictStr]] = Field(default=None, description="The response types to request. Allowed values are 'code' and 'id_token'. Defaults to 'code'.")
    provider_config: Optional[Dict[str, Any]] = Field(default=None, description="Provider-specific configuration. Optional.")
    __properties: ClassVar[List[str]] = ["bound_issuer", "default_role", "jwks_ca_pem", "jwks_url", "jwt_supported_algs", "jwt_validation_pubkeys", "namespace_in_state", "oidc_client_id", "oidc_client_secret", "oidc_discovery_ca_pem", "oidc_discovery_url", "oidc_response_mode", "oidc_response_types", "provider_config"]

    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 JwtConfigureRequest 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 JwtConfigureRequest from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "bound_issuer": obj.get("bound_issuer"),
            "default_role": obj.get("default_role"),
            "jwks_ca_pem": obj.get("jwks_ca_pem"),
            "jwks_url": obj.get("jwks_url"),
            "jwt_supported_algs": obj.get("jwt_supported_algs"),
            "jwt_validation_pubkeys": obj.get("jwt_validation_pubkeys"),
            "namespace_in_state": obj.get("namespace_in_state"),
            "oidc_client_id": obj.get("oidc_client_id"),
            "oidc_client_secret": obj.get("oidc_client_secret"),
            "oidc_discovery_ca_pem": obj.get("oidc_discovery_ca_pem"),
            "oidc_discovery_url": obj.get("oidc_discovery_url"),
            "oidc_response_mode": obj.get("oidc_response_mode"),
            "oidc_response_types": obj.get("oidc_response_types"),
            "provider_config": obj.get("provider_config")
        })
        return _obj


