# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata


class StorageObject(UniversalBaseModel):
    """
    Cloud Storage object (blob) - matches API format
    """

    name: str = pydantic.Field()
    """
    Object name
    """

    bucket: str = pydantic.Field()
    """
    Bucket name
    """

    size: typing.Optional[str] = pydantic.Field(default=None)
    """
    Object size in bytes
    """

    content_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="contentType")] = (
        pydantic.Field(default=None)
    )
    """
    Content type
    """

    time_created: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="timeCreated")] = (
        pydantic.Field(default=None)
    )
    """
    Creation timestamp
    """

    updated: typing.Optional[str] = pydantic.Field(default=None)
    """
    Last update timestamp
    """

    generation: typing.Optional[str] = pydantic.Field(default=None)
    """
    Object generation
    """

    metageneration: typing.Optional[str] = pydantic.Field(default=None)
    """
    Metadata generation
    """

    md5hash: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="md5Hash")] = pydantic.Field(
        default=None
    )
    """
    MD5 hash
    """

    content: typing.Optional[str] = pydantic.Field(default=None)
    """
    Object content (text or base64 encoded)
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
