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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .asset_method import AssetMethod
from .asset_status import AssetStatus


class Asset(UniversalBaseModel):
    """
    A reference file (image, audio, or video) that you upload to the platform for use in downstream workflows such as indexing, analyzing video content, and creating entities.
    """

    id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")] = pydantic.Field(default=None)
    """
    The unique identifier of the asset.
    """

    method: typing.Optional[AssetMethod] = pydantic.Field(default=None)
    """
    Indicates how you uploaded the asset.
    
    **Values**:
    - `direct`: Uploaded from your local file system
    - `url`: Uploaded from a publicly accessible URL
    """

    status: typing.Optional[AssetStatus] = pydantic.Field(default=None)
    """
    Indicates the current status of the asset.
    
    **Values**:
    - `failed`: The platform failed to process the upload
    - `processing`: The platform is processing the uploaded file
    - `ready`: The asset is ready to use
    """

    filename: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the file used to create the asset.
    """

    file_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    The MIME type of the asset file.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    The date and time, in RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when the asset was created.
    """

    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
