"""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_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


ChatMessageContentItemCacheControlType = Literal["ephemeral",]


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


class ChatMessageContentItemCacheControlTypedDict(TypedDict):
    r"""Cache control for the content part"""

    type: ChatMessageContentItemCacheControlType
    ttl: NotRequired[ChatMessageContentItemCacheControlTTL]


class ChatMessageContentItemCacheControl(BaseModel):
    r"""Cache control for the content part"""

    type: ChatMessageContentItemCacheControlType

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