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

from __future__ import annotations
from .v3_services_overlay_dedupkeyoverlay import (
    V3ServicesOverlayDedupKeyOverlay,
    V3ServicesOverlayDedupKeyOverlayTypedDict,
)
from datetime import datetime
from pydantic import model_serializer
from squadcast.types import BaseModel, Nullable, UNSET_SENTINEL
from typing import Literal
from typing_extensions import TypedDict


OverlayTemplateType = Literal["dedup_key",]


class V3ServicesOverlayOverlayResponseTypedDict(TypedDict):
    created_at: datetime
    updated_at: datetime
    deleted_at: Nullable[datetime]
    org_id: str
    service_id: str
    alert_source_version: str
    alert_source_shortname: str
    overlay_template_type: OverlayTemplateType
    overlay: V3ServicesOverlayDedupKeyOverlayTypedDict
    created_by: str
    updated_by: str
    alert_source_type: str


class V3ServicesOverlayOverlayResponse(BaseModel):
    created_at: datetime

    updated_at: datetime

    deleted_at: Nullable[datetime]

    org_id: str

    service_id: str

    alert_source_version: str

    alert_source_shortname: str

    overlay_template_type: OverlayTemplateType

    overlay: V3ServicesOverlayDedupKeyOverlay

    created_by: str

    updated_by: str

    alert_source_type: str

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        serialized = handler(self)
        m = {}

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

            if val != UNSET_SENTINEL:
                m[k] = val

        return m
