# 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 typing_extensions import Annotated
from graphiant_sdk.models.v1_alarm_history_get200_response_history_inner_time import V1AlarmHistoryGet200ResponseHistoryInnerTime
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_bgp import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerBgp
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_circuits_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerCircuitsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_dns import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerDns
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_interfaces_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerInterfacesInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_ipfix_exporters_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpfixExportersInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_ipsec_tunnels_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_location import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerLocation
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_nat_policy import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerNatPolicy
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_prefix_sets_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerPrefixSetsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_region import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRegion
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_routing_policies_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRoutingPoliciesInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_segments_inner import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSegmentsInner
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_site import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSite
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_snmp import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_traffic_policy import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerTrafficPolicy
from graphiant_sdk.models.v1_global_config_patch_request_routing_policies_value_policy_statements_value_statement_matches_value_match_route_tag_entry import V1GlobalConfigPatchRequestRoutingPoliciesValuePolicyStatementsValueStatementMatchesValueMatchRouteTagEntry
from typing import Optional, Set
from typing_extensions import Self

class V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInner(BaseModel):
    """
    V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInner
    """ # noqa: E501
    bgp: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerBgp] = None
    bgp_enabled: Optional[StrictBool] = Field(default=None, alias="bgpEnabled")
    circuits: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerCircuitsInner]] = None
    config_updated_at: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = Field(default=None, alias="configUpdatedAt")
    created_at: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = Field(default=None, alias="createdAt")
    dhcp_server_enabled: Optional[StrictBool] = Field(default=None, alias="dhcpServerEnabled")
    dns: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerDns] = None
    gdi: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
    hostname: Optional[StrictStr] = None
    id: Optional[StrictInt] = None
    interfaces: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerInterfacesInner]] = None
    internal_state: Optional[StrictStr] = Field(default=None, alias="internalState")
    ipfix_enabled: Optional[StrictBool] = Field(default=None, alias="ipfixEnabled")
    ipfix_exporters: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpfixExportersInner]] = Field(default=None, alias="ipfixExporters")
    ipsec_tunnels: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner]] = Field(default=None, alias="ipsecTunnels")
    last_booted_at: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = Field(default=None, alias="lastBootedAt")
    lldp_enabled: Optional[StrictBool] = Field(default=None, alias="lldpEnabled")
    local_route_tag: Optional[V1GlobalConfigPatchRequestRoutingPoliciesValuePolicyStatementsValueStatementMatchesValueMatchRouteTagEntry] = Field(default=None, alias="localRouteTag")
    local_web_server_password: Optional[StrictStr] = Field(default=None, alias="localWebServerPassword")
    location: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerLocation] = None
    maintenance_mode: Optional[StrictBool] = Field(default=None, alias="maintenanceMode")
    nat_policy: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerNatPolicy] = Field(default=None, alias="natPolicy")
    notes: Optional[StrictStr] = None
    oper_staled: Optional[StrictBool] = Field(default=None, alias="operStaled")
    oper_staled_at: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = Field(default=None, alias="operStaledAt")
    oper_updated_at: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = Field(default=None, alias="operUpdatedAt")
    ospfv2_enabled: Optional[StrictBool] = Field(default=None, alias="ospfv2Enabled")
    ospfv3_enabled: Optional[StrictBool] = Field(default=None, alias="ospfv3Enabled")
    platform: Optional[StrictStr] = None
    prefix_sets: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerPrefixSetsInner]] = Field(default=None, alias="prefixSets")
    reboot_reason: Optional[StrictStr] = Field(default=None, alias="rebootReason")
    region: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRegion] = None
    region_override: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRegion] = Field(default=None, alias="regionOverride")
    role: Optional[StrictStr] = None
    routing_policies: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRoutingPoliciesInner]] = Field(default=None, alias="routingPolicies")
    segments: Optional[List[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSegmentsInner]] = None
    serial_number: Optional[StrictStr] = Field(default=None, alias="serialNumber")
    site: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSite] = None
    snmp: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp] = None
    software_version: Optional[StrictStr] = Field(default=None, alias="softwareVersion")
    static_routes_enabled: Optional[StrictBool] = Field(default=None, alias="staticRoutesEnabled")
    status: Optional[StrictStr] = None
    traffic_policy: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerTrafficPolicy] = Field(default=None, alias="trafficPolicy")
    uptime: Optional[V1AlarmHistoryGet200ResponseHistoryInnerTime] = None
    vrrp_enabled: Optional[StrictBool] = Field(default=None, alias="vrrpEnabled")
    __properties: ClassVar[List[str]] = ["bgp", "bgpEnabled", "circuits", "configUpdatedAt", "createdAt", "dhcpServerEnabled", "dns", "gdi", "hostname", "id", "interfaces", "internalState", "ipfixEnabled", "ipfixExporters", "ipsecTunnels", "lastBootedAt", "lldpEnabled", "localRouteTag", "localWebServerPassword", "location", "maintenanceMode", "natPolicy", "notes", "operStaled", "operStaledAt", "operUpdatedAt", "ospfv2Enabled", "ospfv3Enabled", "platform", "prefixSets", "rebootReason", "region", "regionOverride", "role", "routingPolicies", "segments", "serialNumber", "site", "snmp", "softwareVersion", "staticRoutesEnabled", "status", "trafficPolicy", "uptime", "vrrpEnabled"]

    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 V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInner 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 bgp
        if self.bgp:
            _dict['bgp'] = self.bgp.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in circuits (list)
        _items = []
        if self.circuits:
            for _item_circuits in self.circuits:
                if _item_circuits:
                    _items.append(_item_circuits.to_dict())
            _dict['circuits'] = _items
        # override the default output from pydantic by calling `to_dict()` of config_updated_at
        if self.config_updated_at:
            _dict['configUpdatedAt'] = self.config_updated_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of created_at
        if self.created_at:
            _dict['createdAt'] = self.created_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of dns
        if self.dns:
            _dict['dns'] = self.dns.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in interfaces (list)
        _items = []
        if self.interfaces:
            for _item_interfaces in self.interfaces:
                if _item_interfaces:
                    _items.append(_item_interfaces.to_dict())
            _dict['interfaces'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in ipfix_exporters (list)
        _items = []
        if self.ipfix_exporters:
            for _item_ipfix_exporters in self.ipfix_exporters:
                if _item_ipfix_exporters:
                    _items.append(_item_ipfix_exporters.to_dict())
            _dict['ipfixExporters'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in ipsec_tunnels (list)
        _items = []
        if self.ipsec_tunnels:
            for _item_ipsec_tunnels in self.ipsec_tunnels:
                if _item_ipsec_tunnels:
                    _items.append(_item_ipsec_tunnels.to_dict())
            _dict['ipsecTunnels'] = _items
        # override the default output from pydantic by calling `to_dict()` of last_booted_at
        if self.last_booted_at:
            _dict['lastBootedAt'] = self.last_booted_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of local_route_tag
        if self.local_route_tag:
            _dict['localRouteTag'] = self.local_route_tag.to_dict()
        # override the default output from pydantic by calling `to_dict()` of location
        if self.location:
            _dict['location'] = self.location.to_dict()
        # override the default output from pydantic by calling `to_dict()` of nat_policy
        if self.nat_policy:
            _dict['natPolicy'] = self.nat_policy.to_dict()
        # override the default output from pydantic by calling `to_dict()` of oper_staled_at
        if self.oper_staled_at:
            _dict['operStaledAt'] = self.oper_staled_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of oper_updated_at
        if self.oper_updated_at:
            _dict['operUpdatedAt'] = self.oper_updated_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in prefix_sets (list)
        _items = []
        if self.prefix_sets:
            for _item_prefix_sets in self.prefix_sets:
                if _item_prefix_sets:
                    _items.append(_item_prefix_sets.to_dict())
            _dict['prefixSets'] = _items
        # override the default output from pydantic by calling `to_dict()` of region
        if self.region:
            _dict['region'] = self.region.to_dict()
        # override the default output from pydantic by calling `to_dict()` of region_override
        if self.region_override:
            _dict['regionOverride'] = self.region_override.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in routing_policies (list)
        _items = []
        if self.routing_policies:
            for _item_routing_policies in self.routing_policies:
                if _item_routing_policies:
                    _items.append(_item_routing_policies.to_dict())
            _dict['routingPolicies'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in segments (list)
        _items = []
        if self.segments:
            for _item_segments in self.segments:
                if _item_segments:
                    _items.append(_item_segments.to_dict())
            _dict['segments'] = _items
        # override the default output from pydantic by calling `to_dict()` of site
        if self.site:
            _dict['site'] = self.site.to_dict()
        # override the default output from pydantic by calling `to_dict()` of snmp
        if self.snmp:
            _dict['snmp'] = self.snmp.to_dict()
        # override the default output from pydantic by calling `to_dict()` of traffic_policy
        if self.traffic_policy:
            _dict['trafficPolicy'] = self.traffic_policy.to_dict()
        # override the default output from pydantic by calling `to_dict()` of uptime
        if self.uptime:
            _dict['uptime'] = self.uptime.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "bgp": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerBgp.from_dict(obj["bgp"]) if obj.get("bgp") is not None else None,
            "bgpEnabled": obj.get("bgpEnabled"),
            "circuits": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerCircuitsInner.from_dict(_item) for _item in obj["circuits"]] if obj.get("circuits") is not None else None,
            "configUpdatedAt": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["configUpdatedAt"]) if obj.get("configUpdatedAt") is not None else None,
            "createdAt": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["createdAt"]) if obj.get("createdAt") is not None else None,
            "dhcpServerEnabled": obj.get("dhcpServerEnabled"),
            "dns": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerDns.from_dict(obj["dns"]) if obj.get("dns") is not None else None,
            "gdi": obj.get("gdi"),
            "hostname": obj.get("hostname"),
            "id": obj.get("id"),
            "interfaces": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerInterfacesInner.from_dict(_item) for _item in obj["interfaces"]] if obj.get("interfaces") is not None else None,
            "internalState": obj.get("internalState"),
            "ipfixEnabled": obj.get("ipfixEnabled"),
            "ipfixExporters": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpfixExportersInner.from_dict(_item) for _item in obj["ipfixExporters"]] if obj.get("ipfixExporters") is not None else None,
            "ipsecTunnels": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner.from_dict(_item) for _item in obj["ipsecTunnels"]] if obj.get("ipsecTunnels") is not None else None,
            "lastBootedAt": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["lastBootedAt"]) if obj.get("lastBootedAt") is not None else None,
            "lldpEnabled": obj.get("lldpEnabled"),
            "localRouteTag": V1GlobalConfigPatchRequestRoutingPoliciesValuePolicyStatementsValueStatementMatchesValueMatchRouteTagEntry.from_dict(obj["localRouteTag"]) if obj.get("localRouteTag") is not None else None,
            "localWebServerPassword": obj.get("localWebServerPassword"),
            "location": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerLocation.from_dict(obj["location"]) if obj.get("location") is not None else None,
            "maintenanceMode": obj.get("maintenanceMode"),
            "natPolicy": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerNatPolicy.from_dict(obj["natPolicy"]) if obj.get("natPolicy") is not None else None,
            "notes": obj.get("notes"),
            "operStaled": obj.get("operStaled"),
            "operStaledAt": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["operStaledAt"]) if obj.get("operStaledAt") is not None else None,
            "operUpdatedAt": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["operUpdatedAt"]) if obj.get("operUpdatedAt") is not None else None,
            "ospfv2Enabled": obj.get("ospfv2Enabled"),
            "ospfv3Enabled": obj.get("ospfv3Enabled"),
            "platform": obj.get("platform"),
            "prefixSets": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerPrefixSetsInner.from_dict(_item) for _item in obj["prefixSets"]] if obj.get("prefixSets") is not None else None,
            "rebootReason": obj.get("rebootReason"),
            "region": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRegion.from_dict(obj["region"]) if obj.get("region") is not None else None,
            "regionOverride": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRegion.from_dict(obj["regionOverride"]) if obj.get("regionOverride") is not None else None,
            "role": obj.get("role"),
            "routingPolicies": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerRoutingPoliciesInner.from_dict(_item) for _item in obj["routingPolicies"]] if obj.get("routingPolicies") is not None else None,
            "segments": [V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSegmentsInner.from_dict(_item) for _item in obj["segments"]] if obj.get("segments") is not None else None,
            "serialNumber": obj.get("serialNumber"),
            "site": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSite.from_dict(obj["site"]) if obj.get("site") is not None else None,
            "snmp": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerSnmp.from_dict(obj["snmp"]) if obj.get("snmp") is not None else None,
            "softwareVersion": obj.get("softwareVersion"),
            "staticRoutesEnabled": obj.get("staticRoutesEnabled"),
            "status": obj.get("status"),
            "trafficPolicy": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerTrafficPolicy.from_dict(obj["trafficPolicy"]) if obj.get("trafficPolicy") is not None else None,
            "uptime": V1AlarmHistoryGet200ResponseHistoryInnerTime.from_dict(obj["uptime"]) if obj.get("uptime") is not None else None,
            "vrrpEnabled": obj.get("vrrpEnabled")
        })
        return _obj


