# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_ipsec_tunnels_inner_bgp import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerBgp
from graphiant_sdk.models.v1_extranets_get200_response_policies_inner_branches_excluded_devices_inner_ipsec_tunnels_inner_static import V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerStatic
from typing import Optional, Set
from typing_extensions import Self

class V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner(BaseModel):
    """
    V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner
    """ # noqa: E501
    bgp: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerBgp] = None
    destination_address: Optional[StrictStr] = Field(default=None, alias="destinationAddress")
    ike_initiator: Optional[StrictBool] = Field(default=None, alias="ikeInitiator")
    ipsec_label: Optional[StrictStr] = Field(default=None, alias="ipsecLabel")
    lan: Optional[StrictStr] = None
    local_address_v4: Optional[StrictStr] = Field(default=None, alias="localAddressV4")
    local_address_v6: Optional[StrictStr] = Field(default=None, alias="localAddressV6")
    local_circuit: Optional[StrictStr] = Field(default=None, alias="localCircuit")
    local_ike_peer_identity: Optional[StrictStr] = Field(default=None, alias="localIkePeerIdentity")
    mtu: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
    name: Optional[StrictStr] = None
    preshared_key: Optional[StrictStr] = Field(default=None, alias="presharedKey")
    remote_address_v4: Optional[StrictStr] = Field(default=None, alias="remoteAddressV4")
    remote_address_v6: Optional[StrictStr] = Field(default=None, alias="remoteAddressV6")
    remote_ike_peer_identity: Optional[StrictStr] = Field(default=None, alias="remoteIkePeerIdentity")
    static: Optional[V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerStatic] = None
    tcp_mss: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="tcpMss")
    vpn_profile: Optional[StrictStr] = Field(default=None, alias="vpnProfile")
    __properties: ClassVar[List[str]] = ["bgp", "destinationAddress", "ikeInitiator", "ipsecLabel", "lan", "localAddressV4", "localAddressV6", "localCircuit", "localIkePeerIdentity", "mtu", "name", "presharedKey", "remoteAddressV4", "remoteAddressV6", "remoteIkePeerIdentity", "static", "tcpMss", "vpnProfile"]

    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 V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInner 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 static
        if self.static:
            _dict['static'] = self.static.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "bgp": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerBgp.from_dict(obj["bgp"]) if obj.get("bgp") is not None else None,
            "destinationAddress": obj.get("destinationAddress"),
            "ikeInitiator": obj.get("ikeInitiator"),
            "ipsecLabel": obj.get("ipsecLabel"),
            "lan": obj.get("lan"),
            "localAddressV4": obj.get("localAddressV4"),
            "localAddressV6": obj.get("localAddressV6"),
            "localCircuit": obj.get("localCircuit"),
            "localIkePeerIdentity": obj.get("localIkePeerIdentity"),
            "mtu": obj.get("mtu"),
            "name": obj.get("name"),
            "presharedKey": obj.get("presharedKey"),
            "remoteAddressV4": obj.get("remoteAddressV4"),
            "remoteAddressV6": obj.get("remoteAddressV6"),
            "remoteIkePeerIdentity": obj.get("remoteIkePeerIdentity"),
            "static": V1ExtranetsGet200ResponsePoliciesInnerBranchesExcludedDevicesInnerIpsecTunnelsInnerStatic.from_dict(obj["static"]) if obj.get("static") is not None else None,
            "tcpMss": obj.get("tcpMss"),
            "vpnProfile": obj.get("vpnProfile")
        })
        return _obj


