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

from __future__ import annotations
import pydantic
from pydantic import model_serializer
from squadcast.types import BaseModel, UNSET_SENTINEL
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class V3ExportExportResponseTypedDict(TypedDict):
    id: str
    type: str
    status: str
    format_: str
    download_url: NotRequired[str]
    download_url_expires_at: NotRequired[str]
    error_message: NotRequired[str]


class V3ExportExportResponse(BaseModel):
    id: str

    type: str

    status: str

    format_: Annotated[str, pydantic.Field(alias="format")]

    download_url: Optional[str] = None

    download_url_expires_at: Optional[str] = None

    error_message: Optional[str] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            ["download_url", "download_url_expires_at", "error_message"]
        )
        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:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


try:
    V3ExportExportResponse.model_rebuild()
except NameError:
    pass
