# 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_devices_device_id_config_put_request_core_core_vrf_ospfv2_process_areas_value_area_interfaces_value_interface_bfd import V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceBfd
from graphiant_sdk.models.v1_devices_device_id_config_put_request_core_core_vrf_ospfv2_process_areas_value_area_interfaces_value_interface_dead_interval_value import V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceDeadIntervalValue
from graphiant_sdk.models.v1_devices_device_id_config_put_request_core_core_vrf_ospfv2_process_areas_value_area_interfaces_value_interface_hello_interval_value import V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceHelloIntervalValue
from graphiant_sdk.models.v1_devices_device_id_config_put_request_core_core_vrf_ospfv2_process_areas_value_area_interfaces_value_interface_retransmit_interval_value import V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceRetransmitIntervalValue
from typing import Optional, Set
from typing_extensions import Self

class V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterface(BaseModel):
    """
    V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterface
    """ # noqa: E501
    bfd: Optional[V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceBfd] = None
    cost: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
    dead_interval_value: Optional[V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceDeadIntervalValue] = Field(default=None, alias="deadIntervalValue")
    dr_priority: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="drPriority")
    hello_interval_value: Optional[V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceHelloIntervalValue] = Field(default=None, alias="helloIntervalValue")
    interface_name: Optional[StrictStr] = Field(default=None, alias="interfaceName")
    mtu: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
    mtu_ignore: Optional[StrictBool] = Field(default=None, alias="mtuIgnore")
    prefix_sid: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="prefixSid")
    retransmit_interval_value: Optional[V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceRetransmitIntervalValue] = Field(default=None, alias="retransmitIntervalValue")
    type: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["bfd", "cost", "deadIntervalValue", "drPriority", "helloIntervalValue", "interfaceName", "mtu", "mtuIgnore", "prefixSid", "retransmitIntervalValue", "type"]

    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 V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterface 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 bfd
        if self.bfd:
            _dict['bfd'] = self.bfd.to_dict()
        # override the default output from pydantic by calling `to_dict()` of dead_interval_value
        if self.dead_interval_value:
            _dict['deadIntervalValue'] = self.dead_interval_value.to_dict()
        # override the default output from pydantic by calling `to_dict()` of hello_interval_value
        if self.hello_interval_value:
            _dict['helloIntervalValue'] = self.hello_interval_value.to_dict()
        # override the default output from pydantic by calling `to_dict()` of retransmit_interval_value
        if self.retransmit_interval_value:
            _dict['retransmitIntervalValue'] = self.retransmit_interval_value.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "bfd": V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceBfd.from_dict(obj["bfd"]) if obj.get("bfd") is not None else None,
            "cost": obj.get("cost"),
            "deadIntervalValue": V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceDeadIntervalValue.from_dict(obj["deadIntervalValue"]) if obj.get("deadIntervalValue") is not None else None,
            "drPriority": obj.get("drPriority"),
            "helloIntervalValue": V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceHelloIntervalValue.from_dict(obj["helloIntervalValue"]) if obj.get("helloIntervalValue") is not None else None,
            "interfaceName": obj.get("interfaceName"),
            "mtu": obj.get("mtu"),
            "mtuIgnore": obj.get("mtuIgnore"),
            "prefixSid": obj.get("prefixSid"),
            "retransmitIntervalValue": V1DevicesDeviceIdConfigPutRequestCoreCoreVrfOspfv2ProcessAreasValueAreaInterfacesValueInterfaceRetransmitIntervalValue.from_dict(obj["retransmitIntervalValue"]) if obj.get("retransmitIntervalValue") is not None else None,
            "type": obj.get("type")
        })
        return _obj


