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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .presigned_url_chunk import PresignedUrlChunk


class CreateAssetUploadResponse(UniversalBaseModel):
    upload_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique identifier of this upload session. Store this value, as you'll need it for the following subsequent operations:
    - Reporting completed chunks
    - Requesting additional presigned URLs
    - Retrieving the status of this upload session
    
    This identifier remains valid for 24 hours from the time of creation.
    """

    asset_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique identifier for the asset being created. Store this value, as you'll need it to reference the asset in other API calls. Note that this identifier is reserved immediately, but the asset becomes available for other operations only after the upload is completed successfully.
    """

    upload_urls: typing.Optional[typing.List[PresignedUrlChunk]] = pydantic.Field(default=None)
    """
    An array containing the initial set of presigned URLs for uploading chunks. Each URL corresponds to a specific chunk.
    
    Note the following about the presigned URLs:
    - URLs expire after one hour.
    - Depending on the size of the file, the initial set may not include URLs for all chunks. If you need more URLs, you can request additional ones using the [`POST`](/v1.3/api-reference/upload-content/multipart-uploads/get-additional-presigned-urls) method of the `/assets/multipart-uploads/{upload_id}/presigned-urls` endpoint.
    """

    upload_headers: typing.Optional[typing.Dict[str, str]] = None
    chunk_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    The size in bytes for each chunk, except for the last chunk, which may be smaller. Use this value to divide your file into chunks of this exact size.
    """

    total_chunks: typing.Optional[int] = pydantic.Field(default=None)
    """
    The total number of chunks into which your file must be split. Calculated as: ceiling(`total_size` / `chunk_size`).
    """

    expires_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    A string representing the date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the upload URL will expire. Upload URLs expire 24 hours from their creation. After expiration, you cannot resume the upload, and you must create a new upload session.
    """

    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
