# 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_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_communities_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpCommunitiesInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_engine_endpoints_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpEngineEndpointsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_notify_filter_profiles_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpNotifyFilterProfilesInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_targets_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpTargetsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_usm_local_users_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmLocalUsersInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_usm_remote_users_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmRemoteUsersInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp_vacm_groups_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpVacmGroupsInner
from typing import Optional, Set
from typing_extensions import Self

class V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp(BaseModel):
    """
    V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp
    """ # noqa: E501
    communities: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpCommunitiesInner]] = None
    engine_enable_authen_traps: Optional[StrictBool] = Field(default=None, alias="engineEnableAuthenTraps")
    engine_enable_high_memory_traps: Optional[StrictBool] = Field(default=None, alias="engineEnableHighMemoryTraps")
    engine_enable_high_cpu_traps: Optional[StrictBool] = Field(default=None, alias="engineEnableHighCpuTraps")
    engine_enable_local_acess_v4: Optional[StrictBool] = Field(default=None, alias="engineEnableLocalAcessV4")
    engine_enable_local_acess_v6: Optional[StrictBool] = Field(default=None, alias="engineEnableLocalAcessV6")
    engine_enable_user_hints: Optional[StrictBool] = Field(default=None, alias="engineEnableUserHints")
    engine_enable_user_validation: Optional[StrictBool] = Field(default=None, alias="engineEnableUserValidation")
    engine_enabled: Optional[StrictBool] = Field(default=None, alias="engineEnabled")
    engine_endpoints: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpEngineEndpointsInner]] = Field(default=None, alias="engineEndpoints")
    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")
    error_message: Optional[StrictStr] = Field(default=None, alias="errorMessage")
    global_id: Optional[StrictInt] = Field(default=None, alias="globalId")
    id: Optional[StrictInt] = None
    name: Optional[StrictStr] = None
    notify_filter_profiles: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpNotifyFilterProfilesInner]] = Field(default=None, alias="notifyFilterProfiles")
    status: Optional[StrictStr] = None
    targets: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpTargetsInner]] = None
    usm_local_users: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmLocalUsersInner]] = Field(default=None, alias="usmLocalUsers")
    usm_remote_users: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmRemoteUsersInner]] = 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[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpVacmGroupsInner]] = Field(default=None, alias="vacmGroups")
    __properties: ClassVar[List[str]] = ["communities", "engineEnableAuthenTraps", "engineEnableHighMemoryTraps", "engineEnableHighCpuTraps", "engineEnableLocalAcessV4", "engineEnableLocalAcessV6", "engineEnableUserHints", "engineEnableUserValidation", "engineEnabled", "engineEndpoints", "engineIdAdminOctets", "engineIdAdminText", "engineIdIpv4", "engineIdIpv6", "engineIdMac", "engineIdRaw", "errorMessage", "globalId", "id", "name", "notifyFilterProfiles", "status", "targets", "usmLocalUsers", "usmRemoteUsers", "v2cEnabled", "v3Enabled", "vacmGroups"]

    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 V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp 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 item in communities (list)
        _items = []
        if self.communities:
            for _item_communities in self.communities:
                if _item_communities:
                    _items.append(_item_communities.to_dict())
            _dict['communities'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in engine_endpoints (list)
        _items = []
        if self.engine_endpoints:
            for _item_engine_endpoints in self.engine_endpoints:
                if _item_engine_endpoints:
                    _items.append(_item_engine_endpoints.to_dict())
            _dict['engineEndpoints'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in notify_filter_profiles (list)
        _items = []
        if self.notify_filter_profiles:
            for _item_notify_filter_profiles in self.notify_filter_profiles:
                if _item_notify_filter_profiles:
                    _items.append(_item_notify_filter_profiles.to_dict())
            _dict['notifyFilterProfiles'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in targets (list)
        _items = []
        if self.targets:
            for _item_targets in self.targets:
                if _item_targets:
                    _items.append(_item_targets.to_dict())
            _dict['targets'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in usm_local_users (list)
        _items = []
        if self.usm_local_users:
            for _item_usm_local_users in self.usm_local_users:
                if _item_usm_local_users:
                    _items.append(_item_usm_local_users.to_dict())
            _dict['usmLocalUsers'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in usm_remote_users (list)
        _items = []
        if self.usm_remote_users:
            for _item_usm_remote_users in self.usm_remote_users:
                if _item_usm_remote_users:
                    _items.append(_item_usm_remote_users.to_dict())
            _dict['usmRemoteUsers'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in vacm_groups (list)
        _items = []
        if self.vacm_groups:
            for _item_vacm_groups in self.vacm_groups:
                if _item_vacm_groups:
                    _items.append(_item_vacm_groups.to_dict())
            _dict['vacmGroups'] = _items
        return _dict

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

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

        _obj = cls.model_validate({
            "communities": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpCommunitiesInner.from_dict(_item) for _item in obj["communities"]] if obj.get("communities") is not None else None,
            "engineEnableAuthenTraps": obj.get("engineEnableAuthenTraps"),
            "engineEnableHighMemoryTraps": obj.get("engineEnableHighMemoryTraps"),
            "engineEnableHighCpuTraps": obj.get("engineEnableHighCpuTraps"),
            "engineEnableLocalAcessV4": obj.get("engineEnableLocalAcessV4"),
            "engineEnableLocalAcessV6": obj.get("engineEnableLocalAcessV6"),
            "engineEnableUserHints": obj.get("engineEnableUserHints"),
            "engineEnableUserValidation": obj.get("engineEnableUserValidation"),
            "engineEnabled": obj.get("engineEnabled"),
            "engineEndpoints": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpEngineEndpointsInner.from_dict(_item) for _item in obj["engineEndpoints"]] if obj.get("engineEndpoints") is not None else None,
            "engineIdAdminOctets": obj.get("engineIdAdminOctets"),
            "engineIdAdminText": obj.get("engineIdAdminText"),
            "engineIdIpv4": obj.get("engineIdIpv4"),
            "engineIdIpv6": obj.get("engineIdIpv6"),
            "engineIdMac": obj.get("engineIdMac"),
            "engineIdRaw": obj.get("engineIdRaw"),
            "errorMessage": obj.get("errorMessage"),
            "globalId": obj.get("globalId"),
            "id": obj.get("id"),
            "name": obj.get("name"),
            "notifyFilterProfiles": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpNotifyFilterProfilesInner.from_dict(_item) for _item in obj["notifyFilterProfiles"]] if obj.get("notifyFilterProfiles") is not None else None,
            "status": obj.get("status"),
            "targets": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpTargetsInner.from_dict(_item) for _item in obj["targets"]] if obj.get("targets") is not None else None,
            "usmLocalUsers": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmLocalUsersInner.from_dict(_item) for _item in obj["usmLocalUsers"]] if obj.get("usmLocalUsers") is not None else None,
            "usmRemoteUsers": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpUsmRemoteUsersInner.from_dict(_item) for _item in obj["usmRemoteUsers"]] if obj.get("usmRemoteUsers") is not None else None,
            "v2cEnabled": obj.get("v2cEnabled"),
            "v3Enabled": obj.get("v3Enabled"),
            "vacmGroups": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmpVacmGroupsInner.from_dict(_item) for _item in obj["vacmGroups"]] if obj.get("vacmGroups") is not None else None
        })
        return _obj


