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

from __future__ import annotations
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator, validate_const
import pydantic
from pydantic import Discriminator, Tag
from pydantic.functional_validators import AfterValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


class VideoURL2TypedDict(TypedDict):
    url: str


class VideoURL2(BaseModel):
    url: str


class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
    video_url: VideoURL2TypedDict
    type: Literal["video_url"]


class ChatMessageContentItemVideoVideoURL(BaseModel):
    video_url: VideoURL2

    TYPE: Annotated[
        Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
        pydantic.Field(alias="type"),
    ] = "video_url"


class VideoURL1TypedDict(TypedDict):
    url: str


class VideoURL1(BaseModel):
    url: str


class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
    video_url: VideoURL1TypedDict
    type: Literal["input_video"]


class ChatMessageContentItemVideoInputVideo(BaseModel):
    video_url: VideoURL1

    TYPE: Annotated[
        Annotated[
            Literal["input_video"], AfterValidator(validate_const("input_video"))
        ],
        pydantic.Field(alias="type"),
    ] = "input_video"


ChatMessageContentItemVideoTypedDict = TypeAliasType(
    "ChatMessageContentItemVideoTypedDict",
    Union[
        ChatMessageContentItemVideoInputVideoTypedDict,
        ChatMessageContentItemVideoVideoURLTypedDict,
    ],
)


ChatMessageContentItemVideo = Annotated[
    Union[
        Annotated[ChatMessageContentItemVideoInputVideo, Tag("input_video")],
        Annotated[ChatMessageContentItemVideoVideoURL, Tag("video_url")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
