# 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 List, Optional
from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, constr

class PatchedSCIMProviderRequest(BaseModel):
    """
    SCIMProvider Serializer  # noqa: E501
    """
    name: Optional[constr(strict=True, min_length=1)] = None
    property_mappings: Optional[conlist(StrictStr)] = None
    property_mappings_group: Optional[conlist(StrictStr)] = Field(None, description="Property mappings used for group creation/updating.")
    url: Optional[constr(strict=True, min_length=1)] = Field(None, description="Base URL to SCIM requests, usually ends in /v2")
    token: Optional[constr(strict=True, min_length=1)] = Field(None, description="Authentication token")
    exclude_users_service_account: Optional[StrictBool] = None
    filter_group: Optional[StrictStr] = None
    __properties = ["name", "property_mappings", "property_mappings_group", "url", "token", "exclude_users_service_account", "filter_group"]

    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) -> PatchedSCIMProviderRequest:
        """Create an instance of PatchedSCIMProviderRequest 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)
        # set to None if filter_group (nullable) is None
        # and __fields_set__ contains the field
        if self.filter_group is None and "filter_group" in self.__fields_set__:
            _dict['filter_group'] = None

        return _dict

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

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

        _obj = PatchedSCIMProviderRequest.parse_obj({
            "name": obj.get("name"),
            "property_mappings": obj.get("property_mappings"),
            "property_mappings_group": obj.get("property_mappings_group"),
            "url": obj.get("url"),
            "token": obj.get("token"),
            "exclude_users_service_account": obj.get("exclude_users_service_account"),
            "filter_group": obj.get("filter_group")
        })
        return _obj


