# coding: utf-8

"""
    CustomerManagementService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from openapi_client.models.customer.key_value_entity_ofstring_andstring import KeyValueEntityOfstringAndstring
from typing_extensions import Self

class Notification(BaseModel):
    """
    Notification
    """ # noqa: E501
    type_id: Optional[StrictInt] = Field(default=None, alias="TypeId")
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    severity: Optional[StrictInt] = Field(default=None, alias="Severity")
    title: Optional[StrictStr] = Field(default=None, alias="Title")
    message: Optional[StrictStr] = Field(default=None, alias="Message")
    additional_info: Optional[List[Optional[KeyValueEntityOfstringAndstring]]] = Field(default=None, alias="AdditionalInfo")
    __properties: ClassVar[List[str]] = ["TypeId", "Id", "Severity", "Title", "Message", "AdditionalInfo"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	

    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 additional_info (list)
        _items = []
        if self.additional_info:
            for _item_additional_info in self.additional_info:
                if _item_additional_info:
                    _items.append(_item_additional_info.to_dict())
            _dict['AdditionalInfo'] = _items
        # set to None if type_id (nullable) is None
        # and model_fields_set contains the field
        if self.type_id is None and "type_id" in self.model_fields_set:
            _dict['TypeId'] = None

        # set to None if id (nullable) is None
        # and model_fields_set contains the field
        if self.id is None and "id" in self.model_fields_set:
            _dict['Id'] = None

        # set to None if severity (nullable) is None
        # and model_fields_set contains the field
        if self.severity is None and "severity" in self.model_fields_set:
            _dict['Severity'] = None

        # set to None if title (nullable) is None
        # and model_fields_set contains the field
        if self.title is None and "title" in self.model_fields_set:
            _dict['Title'] = None

        # set to None if message (nullable) is None
        # and model_fields_set contains the field
        if self.message is None and "message" in self.model_fields_set:
            _dict['Message'] = None

        # set to None if additional_info (nullable) is None
        # and model_fields_set contains the field
        if self.additional_info is None and "additional_info" in self.model_fields_set:
            _dict['AdditionalInfo'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "TypeId": obj.get("TypeId") if obj.get("TypeId") is not None else None,
                        "Id": obj.get("Id") if obj.get("Id") is not None else None,
                        "Severity": obj.get("Severity") if obj.get("Severity") is not None else None,
                        "Title": obj.get("Title") if obj.get("Title") is not None else None,
                        "Message": obj.get("Message") if obj.get("Message") is not None else None,
                        "AdditionalInfo": [KeyValueEntityOfstringAndstring.from_dict(_item) for _item in obj["AdditionalInfo"]] if obj.get("AdditionalInfo") is not None else None
        })
        return _obj
