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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .chunk_info import ChunkInfo
from .created_at import CreatedAt
from .multipart_upload_status_type import MultipartUploadStatusType
from .page_info import PageInfo
from .updated_at import UpdatedAt


class GetUploadStatusResponse(UniversalBaseModel):
    upload_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique identifier of your upload session.
    """

    status: typing.Optional[MultipartUploadStatusType] = None
    uploaded_chunks: typing.Optional[typing.List[ChunkInfo]] = pydantic.Field(default=None)
    """
    Detailed status for each chunk.
    """

    chunks_completed: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of chunks successfully uploaded and reported. When this value equals `total_chunks`, the status of your upload session transitions to `completed`.
    """

    chunks_failed: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of chunks that failed to upload. If the number is greater than 0, check the `uploaded_chunks` array for specific failures and retry those chunks.
    """

    chunks_pending: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of chunks not yet successfully uploaded. This value is calculated as: `total_chunks` - `chunks_completed` - `chunks_failed`.
    """

    page_info: typing.Optional[PageInfo] = None
    total_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    The size of your file in bytes. You provided this value when you created the upload session.
    """

    uploaded_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of bytes successfully uploaded
    """

    created_at: typing.Optional[CreatedAt] = None
    updated_at: typing.Optional[UpdatedAt] = None

    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
