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

from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_const, validate_open_enum
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


TTL = Union[
    Literal[
        "5m",
        "1h",
    ],
    UnrecognizedStr,
]


class ChatMessageContentItemCacheControlTypedDict(TypedDict):
    type: Literal["ephemeral"]
    ttl: NotRequired[TTL]


class ChatMessageContentItemCacheControl(BaseModel):
    TYPE: Annotated[
        Annotated[Literal["ephemeral"], AfterValidator(validate_const("ephemeral"))],
        pydantic.Field(alias="type"),
    ] = "ephemeral"

    ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None
