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

class BrandRequest(BaseModel):
    """
    Brand Serializer  # noqa: E501
    """
    domain: constr(strict=True, min_length=1) = Field(..., description="Domain that activates this brand. Can be a superset, i.e. `a.b` for `aa.b` and `ba.b`")
    default: Optional[StrictBool] = None
    branding_title: Optional[constr(strict=True, min_length=1)] = None
    branding_logo: Optional[constr(strict=True, min_length=1)] = None
    branding_favicon: Optional[constr(strict=True, min_length=1)] = None
    flow_authentication: Optional[StrictStr] = None
    flow_invalidation: Optional[StrictStr] = None
    flow_recovery: Optional[StrictStr] = None
    flow_unenrollment: Optional[StrictStr] = None
    flow_user_settings: Optional[StrictStr] = None
    flow_device_code: Optional[StrictStr] = None
    web_certificate: Optional[StrictStr] = Field(None, description="Web Certificate used by the authentik Core webserver.")
    attributes: Optional[Any] = None
    __properties = ["domain", "default", "branding_title", "branding_logo", "branding_favicon", "flow_authentication", "flow_invalidation", "flow_recovery", "flow_unenrollment", "flow_user_settings", "flow_device_code", "web_certificate", "attributes"]

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = BrandRequest.parse_obj({
            "domain": obj.get("domain"),
            "default": obj.get("default"),
            "branding_title": obj.get("branding_title"),
            "branding_logo": obj.get("branding_logo"),
            "branding_favicon": obj.get("branding_favicon"),
            "flow_authentication": obj.get("flow_authentication"),
            "flow_invalidation": obj.get("flow_invalidation"),
            "flow_recovery": obj.get("flow_recovery"),
            "flow_unenrollment": obj.get("flow_unenrollment"),
            "flow_user_settings": obj.get("flow_user_settings"),
            "flow_device_code": obj.get("flow_device_code"),
            "web_certificate": obj.get("web_certificate"),
            "attributes": obj.get("attributes")
        })
        return _obj


