# coding: utf-8

"""
    Sonatype Lifecycle Public REST API

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

    The version of the OpenAPI document: 1.196.0-01
    Contact: community@sonatype.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 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 ApiSamlConfigurationDTO(BaseModel):
    """
    Enter the SAML configuration<ul><li>`identityProviderName` the name of the Identity Provider that is displayed on the login page when SAML is configured.</li><li>`entityId` is the URI that IQ Server uses to identify itself in requests to the SSOservice.</li><li>`firstNameAttribute` is the SAML attribute that IQ Server extracts from the login response of the identity provider and uses as the user's first name.</li><li>`lastNameAttribute` is the SAML attribute that IQ Server extracts from the login response of the identity provider and uses as the user's last name.</li><li>`emailAttributeName` is the SAML attribute that IQ Server extracts from the login response of the identity provider to determine the user's email address.</li><li>`usernameAttributeName` is the SAML attribute that IQ Server extracts from the login response of the identity provider to determine the username or id.</li><li>`groupAttributeName` is the SAML attribute that IQ Server extracts from the login response of the identity provider to determine the groups the user belongs to.</li><li>`validateResponseSignature` indicates whether the SAML responses from the identity provider  are cryptographically signed. A `null` value indicates that this setting is derived from the SAML metadata from the identity provider performing signature validation if a signing key (`KeyDescriptor`) is included.<li>`validateAssertionSignature` indicates whether the SAML assertions from the identity provider  are cryptographically signed. A `null` value indicates that this setting is derived from  the SAML metadata from the identity provider performing signature validation if a signing key (`KeyDescriptor`) is included.</li><li>`identityProviderMetadataXml` is the metadata of the identity provider.</li></ul>
    """ # noqa: E501
    email_attribute_name: Optional[StrictStr] = Field(default=None, alias="emailAttributeName")
    entity_id: Optional[StrictStr] = Field(default=None, alias="entityId")
    first_name_attribute_name: Optional[StrictStr] = Field(default=None, alias="firstNameAttributeName")
    groups_attribute_name: Optional[StrictStr] = Field(default=None, alias="groupsAttributeName")
    identity_provider_name: Optional[StrictStr] = Field(default=None, alias="identityProviderName")
    last_name_attribute_name: Optional[StrictStr] = Field(default=None, alias="lastNameAttributeName")
    username_attribute_name: Optional[StrictStr] = Field(default=None, alias="usernameAttributeName")
    validate_assertion_signature: Optional[StrictBool] = Field(default=None, alias="validateAssertionSignature")
    validate_response_signature: Optional[StrictBool] = Field(default=None, alias="validateResponseSignature")
    __properties: ClassVar[List[str]] = ["emailAttributeName", "entityId", "firstNameAttributeName", "groupsAttributeName", "identityProviderName", "lastNameAttributeName", "usernameAttributeName", "validateAssertionSignature", "validateResponseSignature"]

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

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

        _obj = cls.model_validate({
            "emailAttributeName": obj.get("emailAttributeName"),
            "entityId": obj.get("entityId"),
            "firstNameAttributeName": obj.get("firstNameAttributeName"),
            "groupsAttributeName": obj.get("groupsAttributeName"),
            "identityProviderName": obj.get("identityProviderName"),
            "lastNameAttributeName": obj.get("lastNameAttributeName"),
            "usernameAttributeName": obj.get("usernameAttributeName"),
            "validateAssertionSignature": obj.get("validateAssertionSignature"),
            "validateResponseSignature": obj.get("validateResponseSignature")
        })
        return _obj


