# coding: utf-8

"""
    Mycelium API

    Plex music collection and recommendation system using CLAP embeddings

    The version of the OpenAPI document: 0.1.0
    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, Field, ConfigDict
from mycelium.api.generated_sources.server_schemas.models.api_section import APISection
from mycelium.api.generated_sources.server_schemas.models.chroma_section import ChromaSection
from mycelium.api.generated_sources.server_schemas.models.clap_section import ClapSection
from mycelium.api.generated_sources.server_schemas.models.logging_section import LoggingSection
from mycelium.api.generated_sources.server_schemas.models.media_server_section import MediaServerSection
from mycelium.api.generated_sources.server_schemas.models.plex_section import PlexSection
from mycelium.api.generated_sources.server_schemas.models.server_section import ServerSection

class ConfigResponse(BaseModel):
    """
    ConfigResponse
    """
    media_server: MediaServerSection = Field(...)
    plex: PlexSection = Field(...)
    server: ServerSection = Field(...)
    api: APISection = Field(...)
    chroma: ChromaSection = Field(...)
    clap: ClapSection = Field(...)
    logging: LoggingSection = Field(...)
    __properties = ["media_server", "plex", "server", "api", "chroma", "clap", "logging"]

    model_config = {"populate_by_name": True, "validate_assignment": True}
    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"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> ConfigResponse:
        """Create an instance of ConfigResponse 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.model_dump(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of media_server
        if self.media_server:
            _dict['media_server'] = self.media_server.to_dict()
        # override the default output from pydantic by calling `to_dict()` of plex
        if self.plex:
            _dict['plex'] = self.plex.to_dict()
        # override the default output from pydantic by calling `to_dict()` of server
        if self.server:
            _dict['server'] = self.server.to_dict()
        # override the default output from pydantic by calling `to_dict()` of api
        if self.api:
            _dict['api'] = self.api.to_dict()
        # override the default output from pydantic by calling `to_dict()` of chroma
        if self.chroma:
            _dict['chroma'] = self.chroma.to_dict()
        # override the default output from pydantic by calling `to_dict()` of clap
        if self.clap:
            _dict['clap'] = self.clap.to_dict()
        # override the default output from pydantic by calling `to_dict()` of logging
        if self.logging:
            _dict['logging'] = self.logging.to_dict()
        return _dict

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

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

        _obj = ConfigResponse.model_validate({
            "media_server": MediaServerSection.from_dict(obj.get("media_server")) if obj.get("media_server") is not None else None,
            "plex": PlexSection.from_dict(obj.get("plex")) if obj.get("plex") is not None else None,
            "server": ServerSection.from_dict(obj.get("server")) if obj.get("server") is not None else None,
            "api": APISection.from_dict(obj.get("api")) if obj.get("api") is not None else None,
            "chroma": ChromaSection.from_dict(obj.get("chroma")) if obj.get("chroma") is not None else None,
            "clap": ClapSection.from_dict(obj.get("clap")) if obj.get("clap") is not None else None,
            "logging": LoggingSection.from_dict(obj.get("logging")) if obj.get("logging") is not None else None
        })
        return _obj


