# coding: utf-8

"""
    Graphiant APIs

    Graphiant API documentation.

    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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_engine_endpoints_value import V1GlobalConfigPatchRequestSnmpsValueConfigEngineEndpointsValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_notify_filter_profiles_value import V1GlobalConfigPatchRequestSnmpsValueConfigNotifyFilterProfilesValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_targets_value import V1GlobalConfigPatchRequestSnmpsValueConfigTargetsValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_usm_local_users_value import V1GlobalConfigPatchRequestSnmpsValueConfigUsmLocalUsersValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_usm_remote_users_value import V1GlobalConfigPatchRequestSnmpsValueConfigUsmRemoteUsersValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_vacm_groups_value import V1GlobalConfigPatchRequestSnmpsValueConfigVacmGroupsValue
from graphiant_sdk.models.v1_global_config_patch_request_snmps_value_config_vacm_views_value import V1GlobalConfigPatchRequestSnmpsValueConfigVacmViewsValue
from graphiant_sdk.models.v1_portal_apikeys_post_request import V1PortalApikeysPostRequest
from typing import Optional, Set
from typing_extensions import Self

class V1GlobalConfigPatchRequestSnmpsValueConfig(BaseModel):
    """
    V1GlobalConfigPatchRequestSnmpsValueConfig
    """ # noqa: E501
    communities: Optional[Dict[str, V1PortalApikeysPostRequest]] = None
    engine_authen_traps: Optional[StrictBool] = Field(default=None, alias="engineAuthenTraps")
    engine_enabled: Optional[StrictBool] = Field(default=None, alias="engineEnabled")
    engine_endpoints: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigEngineEndpointsValue]] = Field(default=None, alias="engineEndpoints")
    engine_high_cpu_traps: Optional[StrictBool] = Field(default=None, alias="engineHighCpuTraps")
    engine_high_memory_traps: Optional[StrictBool] = Field(default=None, alias="engineHighMemoryTraps")
    engine_id_admin_octets: Optional[StrictStr] = Field(default=None, alias="engineIdAdminOctets")
    engine_id_admin_text: Optional[StrictStr] = Field(default=None, alias="engineIdAdminText")
    engine_id_ipv4: Optional[StrictStr] = Field(default=None, alias="engineIdIpv4")
    engine_id_ipv6: Optional[StrictStr] = Field(default=None, alias="engineIdIpv6")
    engine_id_mac: Optional[StrictStr] = Field(default=None, alias="engineIdMac")
    engine_id_raw: Optional[StrictStr] = Field(default=None, alias="engineIdRaw")
    engine_local_acess_v4: Optional[StrictBool] = Field(default=None, alias="engineLocalAcessV4")
    engine_local_acess_v6: Optional[StrictBool] = Field(default=None, alias="engineLocalAcessV6")
    engine_user_hints: Optional[StrictBool] = Field(default=None, alias="engineUserHints")
    engine_user_validation: Optional[StrictBool] = Field(default=None, alias="engineUserValidation")
    global_id: Optional[StrictInt] = Field(default=None, alias="globalId")
    is_global_sync: Optional[StrictBool] = Field(default=None, alias="isGlobalSync")
    name: Optional[StrictStr] = None
    notify_filter_profiles: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigNotifyFilterProfilesValue]] = Field(default=None, alias="notifyFilterProfiles")
    targets: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigTargetsValue]] = None
    usm_local_users: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigUsmLocalUsersValue]] = Field(default=None, alias="usmLocalUsers")
    usm_remote_users: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigUsmRemoteUsersValue]] = Field(default=None, alias="usmRemoteUsers")
    v2c_enabled: Optional[StrictBool] = Field(default=None, alias="v2cEnabled")
    v3_enabled: Optional[StrictBool] = Field(default=None, alias="v3Enabled")
    vacm_groups: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigVacmGroupsValue]] = Field(default=None, alias="vacmGroups")
    vacm_views: Optional[Dict[str, V1GlobalConfigPatchRequestSnmpsValueConfigVacmViewsValue]] = Field(default=None, alias="vacmViews")
    __properties: ClassVar[List[str]] = ["communities", "engineAuthenTraps", "engineEnabled", "engineEndpoints", "engineHighCpuTraps", "engineHighMemoryTraps", "engineIdAdminOctets", "engineIdAdminText", "engineIdIpv4", "engineIdIpv6", "engineIdMac", "engineIdRaw", "engineLocalAcessV4", "engineLocalAcessV6", "engineUserHints", "engineUserValidation", "globalId", "isGlobalSync", "name", "notifyFilterProfiles", "targets", "usmLocalUsers", "usmRemoteUsers", "v2cEnabled", "v3Enabled", "vacmGroups", "vacmViews"]

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


    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"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of V1GlobalConfigPatchRequestSnmpsValueConfig from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    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 value in communities (dict)
        _field_dict = {}
        if self.communities:
            for _key_communities in self.communities:
                if self.communities[_key_communities]:
                    _field_dict[_key_communities] = self.communities[_key_communities].to_dict()
            _dict['communities'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in engine_endpoints (dict)
        _field_dict = {}
        if self.engine_endpoints:
            for _key_engine_endpoints in self.engine_endpoints:
                if self.engine_endpoints[_key_engine_endpoints]:
                    _field_dict[_key_engine_endpoints] = self.engine_endpoints[_key_engine_endpoints].to_dict()
            _dict['engineEndpoints'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in notify_filter_profiles (dict)
        _field_dict = {}
        if self.notify_filter_profiles:
            for _key_notify_filter_profiles in self.notify_filter_profiles:
                if self.notify_filter_profiles[_key_notify_filter_profiles]:
                    _field_dict[_key_notify_filter_profiles] = self.notify_filter_profiles[_key_notify_filter_profiles].to_dict()
            _dict['notifyFilterProfiles'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in targets (dict)
        _field_dict = {}
        if self.targets:
            for _key_targets in self.targets:
                if self.targets[_key_targets]:
                    _field_dict[_key_targets] = self.targets[_key_targets].to_dict()
            _dict['targets'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in usm_local_users (dict)
        _field_dict = {}
        if self.usm_local_users:
            for _key_usm_local_users in self.usm_local_users:
                if self.usm_local_users[_key_usm_local_users]:
                    _field_dict[_key_usm_local_users] = self.usm_local_users[_key_usm_local_users].to_dict()
            _dict['usmLocalUsers'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in usm_remote_users (dict)
        _field_dict = {}
        if self.usm_remote_users:
            for _key_usm_remote_users in self.usm_remote_users:
                if self.usm_remote_users[_key_usm_remote_users]:
                    _field_dict[_key_usm_remote_users] = self.usm_remote_users[_key_usm_remote_users].to_dict()
            _dict['usmRemoteUsers'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in vacm_groups (dict)
        _field_dict = {}
        if self.vacm_groups:
            for _key_vacm_groups in self.vacm_groups:
                if self.vacm_groups[_key_vacm_groups]:
                    _field_dict[_key_vacm_groups] = self.vacm_groups[_key_vacm_groups].to_dict()
            _dict['vacmGroups'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in vacm_views (dict)
        _field_dict = {}
        if self.vacm_views:
            for _key_vacm_views in self.vacm_views:
                if self.vacm_views[_key_vacm_views]:
                    _field_dict[_key_vacm_views] = self.vacm_views[_key_vacm_views].to_dict()
            _dict['vacmViews'] = _field_dict
        return _dict

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

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

        _obj = cls.model_validate({
            "communities": dict(
                (_k, V1PortalApikeysPostRequest.from_dict(_v))
                for _k, _v in obj["communities"].items()
            )
            if obj.get("communities") is not None
            else None,
            "engineAuthenTraps": obj.get("engineAuthenTraps"),
            "engineEnabled": obj.get("engineEnabled"),
            "engineEndpoints": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigEngineEndpointsValue.from_dict(_v))
                for _k, _v in obj["engineEndpoints"].items()
            )
            if obj.get("engineEndpoints") is not None
            else None,
            "engineHighCpuTraps": obj.get("engineHighCpuTraps"),
            "engineHighMemoryTraps": obj.get("engineHighMemoryTraps"),
            "engineIdAdminOctets": obj.get("engineIdAdminOctets"),
            "engineIdAdminText": obj.get("engineIdAdminText"),
            "engineIdIpv4": obj.get("engineIdIpv4"),
            "engineIdIpv6": obj.get("engineIdIpv6"),
            "engineIdMac": obj.get("engineIdMac"),
            "engineIdRaw": obj.get("engineIdRaw"),
            "engineLocalAcessV4": obj.get("engineLocalAcessV4"),
            "engineLocalAcessV6": obj.get("engineLocalAcessV6"),
            "engineUserHints": obj.get("engineUserHints"),
            "engineUserValidation": obj.get("engineUserValidation"),
            "globalId": obj.get("globalId"),
            "isGlobalSync": obj.get("isGlobalSync"),
            "name": obj.get("name"),
            "notifyFilterProfiles": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigNotifyFilterProfilesValue.from_dict(_v))
                for _k, _v in obj["notifyFilterProfiles"].items()
            )
            if obj.get("notifyFilterProfiles") is not None
            else None,
            "targets": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigTargetsValue.from_dict(_v))
                for _k, _v in obj["targets"].items()
            )
            if obj.get("targets") is not None
            else None,
            "usmLocalUsers": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigUsmLocalUsersValue.from_dict(_v))
                for _k, _v in obj["usmLocalUsers"].items()
            )
            if obj.get("usmLocalUsers") is not None
            else None,
            "usmRemoteUsers": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigUsmRemoteUsersValue.from_dict(_v))
                for _k, _v in obj["usmRemoteUsers"].items()
            )
            if obj.get("usmRemoteUsers") is not None
            else None,
            "v2cEnabled": obj.get("v2cEnabled"),
            "v3Enabled": obj.get("v3Enabled"),
            "vacmGroups": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigVacmGroupsValue.from_dict(_v))
                for _k, _v in obj["vacmGroups"].items()
            )
            if obj.get("vacmGroups") is not None
            else None,
            "vacmViews": dict(
                (_k, V1GlobalConfigPatchRequestSnmpsValueConfigVacmViewsValue.from_dict(_v))
                for _k, _v in obj["vacmViews"].items()
            )
            if obj.get("vacmViews") is not None
            else None
        })
        return _obj


