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

from __future__ import annotations
from .imagegenerationresponse import ImageUsage, ImageUsageTypedDict
from r9s.types import BaseModel
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class ImageGenerationStreamDataTypedDict(TypedDict):
    """Image generation streaming data - single image in the stream"""

    index: int
    r"""Image index in the batch"""

    b64_json: NotRequired[str]
    r"""Base64-encoded partial or final image"""

    url: NotRequired[str]
    r"""Image URL (alternative to b64_json)"""

    progress: NotRequired[float]
    r"""Generation progress (0.0-1.0)"""

    is_final: NotRequired[bool]
    r"""Whether this is the final image"""

    revised_prompt: NotRequired[str]
    r"""Revised prompt (if applicable)"""


class ImageGenerationStreamData(BaseModel):
    """Image generation streaming data - single image in the stream"""

    index: int
    r"""Image index in the batch"""

    b64_json: Optional[str] = None
    r"""Base64-encoded partial or final image"""

    url: Optional[str] = None
    r"""Image URL (alternative to b64_json)"""

    progress: Optional[float] = None
    r"""Generation progress (0.0-1.0)"""

    is_final: Optional[bool] = None
    r"""Whether this is the final image"""

    revised_prompt: Optional[str] = None
    r"""Revised prompt (if applicable)"""


class ImageGenerationStreamEventTypedDict(TypedDict):
    """Image generation streaming event - chunk in SSE stream"""

    id: str
    r"""Unique generation request identifier"""

    created: int
    r"""Unix timestamp"""

    model: str
    r"""Model used for generation"""

    object: str
    r"""Object type identifier (image.generation.chunk)"""

    data: List[ImageGenerationStreamDataTypedDict]
    r"""Array of image data chunks"""

    usage: NotRequired[ImageUsageTypedDict]
    r"""Usage statistics (only in final chunk)"""


class ImageGenerationStreamEvent(BaseModel):
    """Image generation streaming event - chunk in SSE stream"""

    id: str
    r"""Unique generation request identifier"""

    created: int
    r"""Unix timestamp"""

    model: str
    r"""Model used for generation"""

    object: str
    r"""Object type identifier (image.generation.chunk)"""

    data: List[ImageGenerationStreamData]
    r"""Array of image data chunks"""

    usage: Optional[ImageUsage] = None
    r"""Usage statistics (only in final chunk)"""
