# coding: utf-8

"""
    CampaignManagementService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from openapi_client.models.campaign.diagnostics_entity import DiagnosticsEntity
from openapi_client.models.campaign.diagnostics_filter import DiagnosticsFilter
from openapi_client.models.campaign.diagnostics_settings import DiagnosticsSettings
from typing_extensions import Self

class GetDiagnosticsRequest(BaseModel):
    """
    GetDiagnosticsRequest
    """ # noqa: E501
    entities: Optional[List[Optional[DiagnosticsEntity]]] = Field(default=None, alias="Entities")
    checks: Optional[List[Optional[DiagnosticsFilter]]] = Field(default=None, alias="Checks")
    settings: Optional[DiagnosticsSettings] = Field(default=None, alias="Settings")
    caller_name: Optional[StrictStr] = Field(default=None, alias="CallerName")
    __properties: ClassVar[List[str]] = ["Entities", "Checks", "Settings", "CallerName"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in entities (list)
        _items = []
        if self.entities:
            for _item_entities in self.entities:
                if _item_entities:
                    _items.append(_item_entities.to_dict())
            _dict['Entities'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in checks (list)
        _items = []
        if self.checks:
            for _item_checks in self.checks:
                if _item_checks:
                    _items.append(_item_checks.to_dict())
            _dict['Checks'] = _items
        # override the default output from pydantic by calling `to_dict()` of settings
        if self.settings:
            _dict['Settings'] = self.settings.to_dict()
        # set to None if entities (nullable) is None
        # and model_fields_set contains the field
        if self.entities is None and "entities" in self.model_fields_set:
            _dict['Entities'] = None

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of GetDiagnosticsRequest from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "Entities": [DiagnosticsEntity.from_dict(_item) for _item in obj["Entities"]] if obj.get("Entities") is not None else None,
                        "Checks": [DiagnosticsFilter.from_dict(_item) for _item in obj["Checks"]] if obj.get("Checks") is not None else None,
                        "Settings": DiagnosticsSettings.from_dict(obj["Settings"]) if obj.get("Settings") is not None else None,
                        "CallerName": obj.get("CallerName") if obj.get("CallerName") is not None else None
        })
        return _obj
