"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .alertentitytype import AlertEntityType
from .alertinfo import AlertInfo, AlertInfoTypedDict
from .alertstate import AlertState
from .alerttype import AlertType
from .dto_customerresponse import DtoCustomerResponse, DtoCustomerResponseTypedDict
from .dto_featureresponse import DtoFeatureResponse, DtoFeatureResponseTypedDict
from .dto_walletresponse import DtoWalletResponse, DtoWalletResponseTypedDict
from flexprice_py.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class DtoAlertLogResponseTypedDict(TypedDict):
    alert_info: NotRequired[AlertInfoTypedDict]
    alert_status: NotRequired[AlertState]
    alert_type: NotRequired[AlertType]
    created_at: NotRequired[str]
    created_by: NotRequired[str]
    customer: NotRequired[DtoCustomerResponseTypedDict]
    r"""Customer response object containing all customer information"""
    customer_id: NotRequired[str]
    entity_id: NotRequired[str]
    entity_type: NotRequired[AlertEntityType]
    environment_id: NotRequired[str]
    feature: NotRequired[DtoFeatureResponseTypedDict]
    id: NotRequired[str]
    parent_entity_id: NotRequired[str]
    parent_entity_type: NotRequired[str]
    status: NotRequired[str]
    tenant_id: NotRequired[str]
    updated_at: NotRequired[str]
    updated_by: NotRequired[str]
    wallet: NotRequired[DtoWalletResponseTypedDict]


class DtoAlertLogResponse(BaseModel):
    alert_info: Optional[AlertInfo] = None

    alert_status: Optional[AlertState] = None

    alert_type: Optional[AlertType] = None

    created_at: Optional[str] = None

    created_by: Optional[str] = None

    customer: Optional[DtoCustomerResponse] = None
    r"""Customer response object containing all customer information"""

    customer_id: Optional[str] = None

    entity_id: Optional[str] = None

    entity_type: Optional[AlertEntityType] = None

    environment_id: Optional[str] = None

    feature: Optional[DtoFeatureResponse] = None

    id: Optional[str] = None

    parent_entity_id: Optional[str] = None

    parent_entity_type: Optional[str] = None

    status: Optional[str] = None

    tenant_id: Optional[str] = None

    updated_at: Optional[str] = None

    updated_by: Optional[str] = None

    wallet: Optional[DtoWalletResponse] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "alert_info",
                "alert_status",
                "alert_type",
                "created_at",
                "created_by",
                "customer",
                "customer_id",
                "entity_id",
                "entity_type",
                "environment_id",
                "feature",
                "id",
                "parent_entity_id",
                "parent_entity_type",
                "status",
                "tenant_id",
                "updated_at",
                "updated_by",
                "wallet",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
