# 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.v2_childalertlist_post200_response_alert_list_inner_children_alert_list_alert_list_inner_children_alert_list_alert_list_inner_children_alert_list import V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInnerChildrenAlertList
from typing import Optional, Set
from typing_extensions import Self

class V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInner(BaseModel):
    """
    V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInner
    """ # noqa: E501
    acknowledged_list: Optional[List[StrictStr]] = Field(default=None, alias="acknowledgedList")
    acknowledgement_reason: Optional[StrictStr] = Field(default=None, alias="acknowledgementReason")
    alert_body: Optional[StrictStr] = Field(default=None, alias="alertBody")
    alert_id: Optional[StrictStr] = Field(default=None, alias="alertId")
    allow_listed: Optional[StrictBool] = Field(default=None, alias="allowListed")
    children_alert_list: Optional[V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInnerChildrenAlertList] = Field(default=None, alias="childrenAlertList")
    descendant_present: Optional[StrictBool] = Field(default=None, alias="descendantPresent")
    device_id: Optional[StrictStr] = Field(default=None, alias="deviceId")
    end_time: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="endTime")
    enterprise_id: Optional[StrictStr] = Field(default=None, alias="enterpriseId")
    entity: Optional[StrictStr] = None
    interface_name: Optional[StrictStr] = Field(default=None, alias="interfaceName")
    mute_listed: Optional[StrictBool] = Field(default=None, alias="muteListed")
    notification_created: Optional[StrictBool] = Field(default=None, alias="notificationCreated")
    occurrences: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
    peer_device_id: Optional[StrictStr] = Field(default=None, alias="peerDeviceId")
    peer_interface_name: Optional[StrictStr] = Field(default=None, alias="peerInterfaceName")
    peer_name: Optional[StrictStr] = Field(default=None, alias="peerName")
    plane: Optional[StrictStr] = None
    reason: Optional[StrictStr] = None
    recommendation: Optional[StrictStr] = None
    rule_id: Optional[StrictStr] = Field(default=None, alias="ruleId")
    severity: Optional[StrictStr] = None
    site_id: Optional[StrictStr] = Field(default=None, alias="siteId")
    start_time: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="startTime")
    status: Optional[StrictStr] = None
    troubleshooting_disabled_reason: Optional[StrictStr] = Field(default=None, alias="troubleshootingDisabledReason")
    troubleshooting_enabled: Optional[StrictBool] = Field(default=None, alias="troubleshootingEnabled")
    tunnel_interface_name: Optional[StrictStr] = Field(default=None, alias="tunnelInterfaceName")
    type: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["acknowledgedList", "acknowledgementReason", "alertBody", "alertId", "allowListed", "childrenAlertList", "descendantPresent", "deviceId", "endTime", "enterpriseId", "entity", "interfaceName", "muteListed", "notificationCreated", "occurrences", "peerDeviceId", "peerInterfaceName", "peerName", "plane", "reason", "recommendation", "ruleId", "severity", "siteId", "startTime", "status", "troubleshootingDisabledReason", "troubleshootingEnabled", "tunnelInterfaceName", "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 V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInner 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 children_alert_list
        if self.children_alert_list:
            _dict['childrenAlertList'] = self.children_alert_list.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "acknowledgedList": obj.get("acknowledgedList"),
            "acknowledgementReason": obj.get("acknowledgementReason"),
            "alertBody": obj.get("alertBody"),
            "alertId": obj.get("alertId"),
            "allowListed": obj.get("allowListed"),
            "childrenAlertList": V2ChildalertlistPost200ResponseAlertListInnerChildrenAlertListAlertListInnerChildrenAlertListAlertListInnerChildrenAlertList.from_dict(obj["childrenAlertList"]) if obj.get("childrenAlertList") is not None else None,
            "descendantPresent": obj.get("descendantPresent"),
            "deviceId": obj.get("deviceId"),
            "endTime": obj.get("endTime"),
            "enterpriseId": obj.get("enterpriseId"),
            "entity": obj.get("entity"),
            "interfaceName": obj.get("interfaceName"),
            "muteListed": obj.get("muteListed"),
            "notificationCreated": obj.get("notificationCreated"),
            "occurrences": obj.get("occurrences"),
            "peerDeviceId": obj.get("peerDeviceId"),
            "peerInterfaceName": obj.get("peerInterfaceName"),
            "peerName": obj.get("peerName"),
            "plane": obj.get("plane"),
            "reason": obj.get("reason"),
            "recommendation": obj.get("recommendation"),
            "ruleId": obj.get("ruleId"),
            "severity": obj.get("severity"),
            "siteId": obj.get("siteId"),
            "startTime": obj.get("startTime"),
            "status": obj.get("status"),
            "troubleshootingDisabledReason": obj.get("troubleshootingDisabledReason"),
            "troubleshootingEnabled": obj.get("troubleshootingEnabled"),
            "tunnelInterfaceName": obj.get("tunnelInterfaceName"),
            "type": obj.get("type")
        })
        return _obj


