# 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, StrictStr, conlist
from authentik_client.models.footer_link import FooterLink
from authentik_client.models.ui_theme_enum import UiThemeEnum

class CurrentBrand(BaseModel):
    """
    Partial brand information for styling  # noqa: E501
    """
    matched_domain: StrictStr = Field(...)
    branding_title: StrictStr = Field(...)
    branding_logo: StrictStr = Field(...)
    branding_favicon: StrictStr = Field(...)
    ui_footer_links: conlist(FooterLink) = Field(...)
    ui_theme: UiThemeEnum = Field(...)
    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
    default_locale: StrictStr = Field(...)
    __properties = ["matched_domain", "branding_title", "branding_logo", "branding_favicon", "ui_footer_links", "ui_theme", "flow_authentication", "flow_invalidation", "flow_recovery", "flow_unenrollment", "flow_user_settings", "flow_device_code", "default_locale"]

    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) -> CurrentBrand:
        """Create an instance of CurrentBrand 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={
                            "ui_footer_links",
                            "ui_theme",
                            "default_locale",
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of each item in ui_footer_links (list)
        _items = []
        if self.ui_footer_links:
            for _item in self.ui_footer_links:
                if _item:
                    _items.append(_item.to_dict())
            _dict['ui_footer_links'] = _items
        return _dict

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

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

        _obj = CurrentBrand.parse_obj({
            "matched_domain": obj.get("matched_domain"),
            "branding_title": obj.get("branding_title"),
            "branding_logo": obj.get("branding_logo"),
            "branding_favicon": obj.get("branding_favicon"),
            "ui_footer_links": [FooterLink.from_dict(_item) for _item in obj.get("ui_footer_links")] if obj.get("ui_footer_links") is not None else None,
            "ui_theme": obj.get("ui_theme"),
            "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"),
            "default_locale": obj.get("default_locale")
        })
        return _obj


