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

from typing import Union, Optional
from datetime import datetime
from typing_extensions import Literal, Annotated, TypeAlias

from ..._utils import PropertyInfo
from ..._models import BaseModel
from .flexible_test_case_schema import FlexibleTestCaseSchema
from .artifact_schema_generation import ArtifactSchemaGeneration
from .generation_test_case_schema import GenerationTestCaseSchema

__all__ = [
    "TestCase",
    "GenerationTestCaseVersionResponse",
    "GenerationTestCaseVersionResponseTestCaseData",
    "FlexibleTestCaseVersionResponse",
]

GenerationTestCaseVersionResponseTestCaseData: TypeAlias = Union[ArtifactSchemaGeneration, GenerationTestCaseSchema]


class GenerationTestCaseVersionResponse(BaseModel):
    id: str
    """The unique identifier of the entity."""

    account_id: str
    """The ID of the account that owns the given entity."""

    autogenerated: bool
    """Boolean to track whether or not the test case is autogenerated"""

    created_at: datetime
    """The date and time when the entity was created in ISO format."""

    created_by_user_id: str
    """The user who originally created the entity."""

    evaluation_dataset_id: str
    """The ID of the associated evaluation dataset."""

    test_case_data: GenerationTestCaseVersionResponseTestCaseData

    archived_at: Optional[datetime] = None
    """The date and time when the entity was archived in ISO format."""

    chat_history: Optional[object] = None
    """Used for tracking previous chat interactions for multi-chat test cases"""

    schema_type: Optional[Literal["GENERATION"]] = None

    test_case_metadata: Optional[object] = None
    """Metadata for the test case"""


class FlexibleTestCaseVersionResponse(BaseModel):
    id: str
    """The unique identifier of the entity."""

    account_id: str
    """The ID of the account that owns the given entity."""

    autogenerated: bool
    """Boolean to track whether or not the test case is autogenerated"""

    created_at: datetime
    """The date and time when the entity was created in ISO format."""

    created_by_user_id: str
    """The user who originally created the entity."""

    evaluation_dataset_id: str
    """The ID of the associated evaluation dataset."""

    test_case_data: FlexibleTestCaseSchema

    archived_at: Optional[datetime] = None
    """The date and time when the entity was archived in ISO format."""

    chat_history: Optional[object] = None
    """Used for tracking previous chat interactions for multi-chat test cases"""

    schema_type: Optional[Literal["FLEXIBLE"]] = None

    test_case_metadata: Optional[object] = None
    """Metadata for the test case"""


TestCase: TypeAlias = Annotated[
    Union[GenerationTestCaseVersionResponse, FlexibleTestCaseVersionResponse], PropertyInfo(discriminator="schema_type")
]
