# coding: utf-8

"""
    authentik

    Making authentication simple.

    The version of the OpenAPI document: 2024.2.2
    Contact: hello@goauthentik.io
    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, StrictBool, StrictStr

class SourceType(BaseModel):
    """
    Serializer for SourceType  # noqa: E501
    """
    name: StrictStr = Field(...)
    verbose_name: StrictStr = Field(...)
    urls_customizable: StrictBool = Field(...)
    request_token_url: Optional[StrictStr] = Field(...)
    authorization_url: Optional[StrictStr] = Field(...)
    access_token_url: Optional[StrictStr] = Field(...)
    profile_url: Optional[StrictStr] = Field(...)
    oidc_well_known_url: Optional[StrictStr] = Field(...)
    oidc_jwks_url: Optional[StrictStr] = Field(...)
    __properties = ["name", "verbose_name", "urls_customizable", "request_token_url", "authorization_url", "access_token_url", "profile_url", "oidc_well_known_url", "oidc_jwks_url"]

    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) -> SourceType:
        """Create an instance of SourceType 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={
                            "request_token_url",
                            "authorization_url",
                            "access_token_url",
                            "profile_url",
                            "oidc_well_known_url",
                            "oidc_jwks_url",
                          },
                          exclude_none=True)
        # set to None if request_token_url (nullable) is None
        # and __fields_set__ contains the field
        if self.request_token_url is None and "request_token_url" in self.__fields_set__:
            _dict['request_token_url'] = None

        # set to None if authorization_url (nullable) is None
        # and __fields_set__ contains the field
        if self.authorization_url is None and "authorization_url" in self.__fields_set__:
            _dict['authorization_url'] = None

        # set to None if access_token_url (nullable) is None
        # and __fields_set__ contains the field
        if self.access_token_url is None and "access_token_url" in self.__fields_set__:
            _dict['access_token_url'] = None

        # set to None if profile_url (nullable) is None
        # and __fields_set__ contains the field
        if self.profile_url is None and "profile_url" in self.__fields_set__:
            _dict['profile_url'] = None

        # set to None if oidc_well_known_url (nullable) is None
        # and __fields_set__ contains the field
        if self.oidc_well_known_url is None and "oidc_well_known_url" in self.__fields_set__:
            _dict['oidc_well_known_url'] = None

        # set to None if oidc_jwks_url (nullable) is None
        # and __fields_set__ contains the field
        if self.oidc_jwks_url is None and "oidc_jwks_url" in self.__fields_set__:
            _dict['oidc_jwks_url'] = None

        return _dict

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

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

        _obj = SourceType.parse_obj({
            "name": obj.get("name"),
            "verbose_name": obj.get("verbose_name"),
            "urls_customizable": obj.get("urls_customizable"),
            "request_token_url": obj.get("request_token_url"),
            "authorization_url": obj.get("authorization_url"),
            "access_token_url": obj.get("access_token_url"),
            "profile_url": obj.get("profile_url"),
            "oidc_well_known_url": obj.get("oidc_well_known_url"),
            "oidc_jwks_url": obj.get("oidc_jwks_url")
        })
        return _obj


