# coding: utf-8

"""
    Mycelium Worker (Client) API

    Configuration API for Mycelium client workers

    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.worker_schemas.models.worker_clap_section import WorkerClapSection
from mycelium.api.generated_sources.worker_schemas.models.worker_client_api_section import WorkerClientAPISection
from mycelium.api.generated_sources.worker_schemas.models.worker_client_section import WorkerClientSection
from mycelium.api.generated_sources.worker_schemas.models.worker_logging_section import WorkerLoggingSection

class WorkerConfigResponse(BaseModel):
    """
    WorkerConfigResponse
    """
    client: WorkerClientSection = Field(...)
    client_api: WorkerClientAPISection = Field(...)
    clap: WorkerClapSection = Field(...)
    logging: WorkerLoggingSection = Field(...)
    __properties = ["client", "client_api", "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) -> WorkerConfigResponse:
        """Create an instance of WorkerConfigResponse 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 client
        if self.client:
            _dict['client'] = self.client.to_dict()
        # override the default output from pydantic by calling `to_dict()` of client_api
        if self.client_api:
            _dict['client_api'] = self.client_api.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) -> WorkerConfigResponse:
        """Create an instance of WorkerConfigResponse from a dict"""
        if obj is None:
            return None

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

        _obj = WorkerConfigResponse.model_validate({
            "client": WorkerClientSection.from_dict(obj.get("client")) if obj.get("client") is not None else None,
            "client_api": WorkerClientAPISection.from_dict(obj.get("client_api")) if obj.get("client_api") is not None else None,
            "clap": WorkerClapSection.from_dict(obj.get("clap")) if obj.get("clap") is not None else None,
            "logging": WorkerLoggingSection.from_dict(obj.get("logging")) if obj.get("logging") is not None else None
        })
        return _obj


