# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

from ..._models import BaseModel

__all__ = ["Artifact", "Chunk", "ChunksStatus"]


class Chunk(BaseModel):
    chunk_id: str
    """Unique ID of the chunk."""

    chunk_position: int
    """Position of the chunk in the artifact."""

    text: str
    """Associated text of the chunk."""

    upload_status: Literal["Embedding", "Pending", "Completed", "Failed", "Uploading"]
    """An enumeration."""

    embedding: Optional[List[float]] = None
    """Vector embedding of the chunk's text. Null if not embedded yet."""

    metadata: Optional[object] = None
    """Additional metadata associated with the chunk."""

    status_reason: Optional[str] = None
    """Reason for the chunk's upload status."""

    user_supplied_metadata: Optional[object] = None
    """Additional metadata associated with the chunk generated by custom chunking"""


class ChunksStatus(BaseModel):
    chunks_completed: int
    """Number of chunks uploaded successfully."""

    chunks_failed: int
    """Number of chunks that failed upload."""

    chunks_pending: int
    """Number of chunks awaiting upload."""


class Artifact(BaseModel):
    artifact_id: str
    """Unique identifier for the artifact."""

    artifact_name: str
    """Friendly name for the artifact."""

    artifact_uri: str
    """Location (e.g. URI) of the artifact in the data source."""

    chunks: List[Chunk]
    """List of chunks associated with the artifact."""

    chunks_status: ChunksStatus
    """Number of chunks pending, completed, and failed."""

    source: Literal[
        "S3", "Confluence", "SharePoint", "GoogleDrive", "AzureBlobStorage", "Slack", "LocalFile", "LocalChunks"
    ]
    """An enumeration."""

    status: str
    """Status of the artifact."""

    artifact_uri_public: Optional[str] = None
    """Public Location (e.g. URI) of the artifact in the data source."""

    status_reason: Optional[str] = None
    """Reason for the artifact's status."""

    updated_at: Optional[datetime] = None
    """Timestamp at which the artifact was last updated."""
