"""Quantum AI Python SDK."""

from .client import Client, AsyncClient, DEFAULT_BASE_URL
from .errors import APIError, is_rate_limit_error, is_auth_error, is_not_found_error
from .types import (
    TICKS_PER_USD,
    # Agent
    AgentRunRequest,
    AgentWorker,
    MissionRunRequest,
    # Alignment / Advanced Audio
    AlignmentResponse,
    AlignmentWord,
    AudioResponse,
    DialogueRequest,
    DialogueVoice,
    VoiceDesignResponse,
    # API Keys
    APIKeyCreateRequest,
    APIKeyCreateResponse,
    APIKeyInfo,
    APIKeyListResponse,
    # Account
    BalanceResponse,
    # Chat
    ChatMessage,
    ChatRequest,
    ChatResponse,
    ChatTool,
    ChatUsage,
    ContentBlock,
    # Chunk / Process Documents
    ChunkDocumentRequest,
    ChunkDocumentResponse,
    ProcessDocumentRequest,
    ProcessDocumentResponse,
    # Compute
    ComputeInstance,
    ComputeProvisionRequest,
    ComputeProvisionResponse,
    ComputeTemplate,
    # Contact
    ContactRequest,
    ContactResponse,
    # Documents
    DocumentRequest,
    DocumentResponse,
    # Embeddings
    EmbedRequest,
    EmbedResponse,
    # Image
    GeneratedImage,
    ImageEditRequest,
    ImageEditResponse,
    ImageRequest,
    ImageResponse,
    # Jobs
    JobCreateResponse,
    JobListResponse,
    JobStatusResponse,
    # Models
    ModelInfo,
    PricingInfo,
    # Music / Audio
    MusicClip,
    MusicRequest,
    MusicResponse,
    SoundEffectResponse,
    STTRequest,
    STTResponse,
    TTSRequest,
    TTSResponse,
    # Pricing
    PricingEntry,
    PricingResponse,
    # RAG
    RAGCorpus,
    RAGResult,
    RAGSearchRequest,
    RAGSearchResponse,
    SurrealRAGProvider,
    SurrealRAGProvidersResponse,
    SurrealRAGResult,
    SurrealRAGSearchRequest,
    SurrealRAGSearchResponse,
    # Session Chat
    ContextConfig,
    SessionChatRequest,
    SessionChatResponse,
    # Streaming
    StreamDelta,
    StreamEvent,
    StreamToolUse,
    # Usage
    UsageEntry,
    UsageResponse,
    UsageSummaryMonth,
    UsageSummaryResponse,
    # Video
    GeneratedVideo,
    HeyGenAvatar,
    HeyGenTemplate,
    HeyGenVoice,
    VideoDigitalTwinRequest,
    VideoPhotoAvatarRequest,
    VideoRequest,
    VideoResponse,
    VideoStudioRequest,
    VideoTranslateRequest,
    # Voices
    VoiceCloneResponse,
    VoiceInfo,
    VoiceListResponse,
)

from .types_ext import (
    # Existing
    SharedVoice,
    SharedVoicesResponse,
    AddVoiceFromLibraryResponse,
    MusicFinetuneInfo,
    MusicFinetuneListResponse,
    BillingEntry,
    BillingResponse,
    JobStreamEvent,
    # Agent / Mission
    AgentRequest,
    AgentStreamEvent,
    MissionWorker,
    MissionRequest,
    # Session
    SessionContext,
    ToolResult,
    # Search
    WebSearchRequest,
    WebResult,
    NewsResult,
    VideoResult,
    InfoboxResult,
    DiscussionResult,
    WebSearchResponse,
    SearchContextRequest,
    SearchContextChunk,
    SearchContextSource,
    SearchContextResponse,
    SearchAnswerMessage,
    SearchAnswerRequest,
    SearchAnswerCitation,
    SearchAnswerChoice,
    SearchAnswerResponse,
    # Audio (Rust SDK names)
    TtsRequest,
    TtsResponse,
    SttRequest,
    SttResponse,
    SoundEffectRequest,
    SpeechToSpeechRequest,
    IsolateRequest,
    RemixRequest,
    DubRequest,
    AlignRequest,
    AlignmentSegment,
    AlignResponse,
    VoiceDesignRequest,
    StarfishTTSRequest,
    DialogueTurn,
    # Eleven Music
    MusicSection,
    ElevenMusicRequest,
    ElevenMusicClip,
    ElevenMusicResponse,
    FinetuneInfo,
    ListFinetunesResponse,
    # Voices (Rust SDK names)
    Voice,
    VoicesResponse,
    CloneVoiceFile,
    CloneVoiceResponse as CloneVoiceResponseExt,
    VoiceLibraryQuery,
    # Keys (Rust SDK names)
    CreateKeyRequest,
    KeyDetails,
    CreateKeyResponse,
    ListKeysResponse,
    StatusResponse,
    # Compute (Rust SDK names)
    TemplatesResponse,
    ProvisionRequest,
    ProvisionResponse,
    InstancesResponse,
    InstanceResponse,
    DeleteResponse,
    SSHKeyRequest,
    BillingRequest,
    # Video (Rust SDK names)
    JobResponse,
    StudioClip,
    StudioVideoRequest,
    TranslateRequest,
    PhotoAvatarRequest,
    DigitalTwinRequest,
    Avatar,
    AvatarsResponse,
    VideoTemplate,
    VideoTemplatesResponse,
    HeyGenVoicesResponse,
    # Documents (Rust SDK names)
    ChunkRequest,
    DocumentChunk,
    ChunkResponse,
    ProcessRequest,
    ProcessResponse,
    # Jobs (Rust SDK names)
    JobCreateRequest,
    JobSummary,
    ListJobsResponse as ListJobsResponseExt,
    # Batch
    BatchJob,
    # RAG (Rust SDK names)
    RagSearchRequest,
    RagResult,
    RagSearchResponse,
    RagCorpus,
    SurrealRagSearchRequest,
    SurrealRagResult,
    SurrealRagSearchResponse,
    SurrealRagProvider,
    SurrealRagProvidersResponse,
    # Error types
    ApiError,
    Error,
    # Account
    UsageQuery,
    CreditPurchaseRequest,
    DevProgramApplyRequest,
    CreditTier,
    # Auth
    AuthAppleRequest,
    # Response Meta
    ResponseMeta,
    # Realtime (Rust SDK names)
    RealtimeSession as RealtimeSessionType,
    RealtimeEvent as RealtimeEventType,
    # 3D Mesh
    RemeshRequest,
    ModelUrls,
    RetextureRequest,
    RigRequest,
    AnimationPostProcess,
    AnimateRequest,
    # --- New types for cross-SDK parity ---
    # Citation (chat.rs)
    Citation,
    # Audio responses (audio.rs)
    AlignedWord,
    DialogueResponse,
    DubResponse,
    SpeechToSpeechResponse,
    IsolateVoiceResponse,
    RemixVoiceResponse,
    VoicePreview,
    StarfishTTSResponse,
    IsolateVoiceRequest,
    RemixVoiceRequest,
    # Music advanced (audio.rs)
    MusicAdvancedClip,
    MusicAdvancedRequest,
    MusicAdvancedResponse,
    MusicFinetuneCreateRequest,
    # RAG collection wrappers (rag.rs)
    CollectionDocumentsResponse,
    CollectionSearchResponse,
    CollectionsListResponse,
    CreateCollectionRequest,
    DeleteCollectionResponse,
    # Search canonical names (search.rs)
    Discussion,
    Infobox,
    # Models / RAG wrappers (models.rs / rag.rs)
    ModelsResponse,
    RagCorporaResponse,
    SurrealRagProviderInfo,
    # TTS/STT long-form aliases
    TextToSpeechRequest,
    TextToSpeechResponse,
    SpeechToTextRequest,
    SpeechToTextResponse,
)

# Realtime (lazy — requires websockets extra)
from .realtime import (
    RealtimeConfig, RealtimeEvent, RealtimeSessionResponse,
    RealtimeSender, RealtimeReceiver,
    realtime_connect, realtime_connect_direct,
    realtime_session, realtime_end, realtime_refresh,
)

# Patch extension methods onto Client and AsyncClient
from . import client_ext as _client_ext  # noqa: F401

__all__ = [
    # Clients
    "Client",
    "AsyncClient",
    "DEFAULT_BASE_URL",
    # Errors
    "APIError",
    "is_rate_limit_error",
    "is_auth_error",
    "is_not_found_error",
    # Constants
    "TICKS_PER_USD",
    # Agent
    "AgentRunRequest",
    "AgentWorker",
    "MissionRunRequest",
    "AgentRequest",
    "AgentStreamEvent",
    "MissionWorker",
    "MissionRequest",
    # Advanced Audio
    "AlignmentResponse",
    "AlignmentWord",
    "AudioResponse",
    "DialogueRequest",
    "DialogueVoice",
    "VoiceDesignResponse",
    # API Keys
    "APIKeyCreateRequest",
    "APIKeyCreateResponse",
    "APIKeyInfo",
    "APIKeyListResponse",
    # Chat
    "ChatMessage",
    "ChatRequest",
    "ChatResponse",
    "ChatTool",
    "ChatUsage",
    "ContentBlock",
    # Chunk / Process Documents
    "ChunkDocumentRequest",
    "ChunkDocumentResponse",
    "ProcessDocumentRequest",
    "ProcessDocumentResponse",
    # Compute
    "ComputeInstance",
    "ComputeProvisionRequest",
    "ComputeProvisionResponse",
    "ComputeTemplate",
    # Contact
    "ContactRequest",
    "ContactResponse",
    # Documents
    "DocumentRequest",
    "DocumentResponse",
    # Embeddings
    "EmbedRequest",
    "EmbedResponse",
    # Image
    "GeneratedImage",
    "ImageEditRequest",
    "ImageEditResponse",
    "ImageRequest",
    "ImageResponse",
    # Jobs
    "JobCreateResponse",
    "JobListResponse",
    "JobStatusResponse",
    "JobStreamEvent",
    # Models
    "ModelInfo",
    "PricingInfo",
    # Audio
    "MusicClip",
    "MusicRequest",
    "MusicResponse",
    "SoundEffectResponse",
    "STTRequest",
    "STTResponse",
    "TTSRequest",
    "TTSResponse",
    # Pricing
    "PricingEntry",
    "PricingResponse",
    # RAG
    "RAGCorpus",
    "RAGResult",
    "RAGSearchRequest",
    "RAGSearchResponse",
    "SurrealRAGProvider",
    "SurrealRAGProvidersResponse",
    "SurrealRAGResult",
    "SurrealRAGSearchRequest",
    "SurrealRAGSearchResponse",
    # Session Chat
    "ContextConfig",
    "SessionChatRequest",
    "SessionChatResponse",
    "SessionContext",
    "ToolResult",
    # Streaming
    "StreamDelta",
    "StreamEvent",
    "StreamToolUse",
    # Account / Usage
    "BalanceResponse",
    "UsageEntry",
    "UsageResponse",
    "UsageSummaryMonth",
    "UsageSummaryResponse",
    "UsageQuery",
    # Video
    "GeneratedVideo",
    "HeyGenAvatar",
    "HeyGenTemplate",
    "HeyGenVoice",
    "VideoDigitalTwinRequest",
    "VideoPhotoAvatarRequest",
    "VideoRequest",
    "VideoResponse",
    "VideoStudioRequest",
    "VideoTranslateRequest",
    # Voices
    "VoiceCloneResponse",
    "VoiceInfo",
    "VoiceListResponse",
    # Voice Library
    "SharedVoice",
    "SharedVoicesResponse",
    "AddVoiceFromLibraryResponse",
    # Finetunes
    "MusicFinetuneInfo",
    "MusicFinetuneListResponse",
    # Compute Billing
    "BillingEntry",
    "BillingResponse",
    # Realtime
    "RealtimeConfig",
    "RealtimeEvent",
    "RealtimeSessionResponse",
    "RealtimeSender",
    "RealtimeReceiver",
    "realtime_connect",
    "realtime_connect_direct",
    "realtime_session",
    "realtime_end",
    "realtime_refresh",
    # Search
    "WebSearchRequest",
    "WebResult",
    "NewsResult",
    "VideoResult",
    "InfoboxResult",
    "DiscussionResult",
    "WebSearchResponse",
    "SearchContextRequest",
    "SearchContextChunk",
    "SearchContextSource",
    "SearchContextResponse",
    "SearchAnswerMessage",
    "SearchAnswerRequest",
    "SearchAnswerCitation",
    "SearchAnswerChoice",
    "SearchAnswerResponse",
    # Audio (Rust SDK names)
    "TtsRequest",
    "TtsResponse",
    "SttRequest",
    "SttResponse",
    "SoundEffectRequest",
    "SpeechToSpeechRequest",
    "IsolateRequest",
    "RemixRequest",
    "DubRequest",
    "AlignRequest",
    "AlignmentSegment",
    "AlignResponse",
    "VoiceDesignRequest",
    "StarfishTTSRequest",
    "DialogueTurn",
    # Eleven Music
    "MusicSection",
    "ElevenMusicRequest",
    "ElevenMusicClip",
    "ElevenMusicResponse",
    "FinetuneInfo",
    "ListFinetunesResponse",
    # Voices (Rust SDK names)
    "Voice",
    "VoicesResponse",
    "CloneVoiceFile",
    "VoiceLibraryQuery",
    # Keys (Rust SDK names)
    "CreateKeyRequest",
    "KeyDetails",
    "CreateKeyResponse",
    "ListKeysResponse",
    "StatusResponse",
    # Compute (Rust SDK names)
    "TemplatesResponse",
    "ProvisionRequest",
    "ProvisionResponse",
    "InstancesResponse",
    "InstanceResponse",
    "DeleteResponse",
    "SSHKeyRequest",
    "BillingRequest",
    # Video (Rust SDK names)
    "JobResponse",
    "StudioClip",
    "StudioVideoRequest",
    "TranslateRequest",
    "PhotoAvatarRequest",
    "DigitalTwinRequest",
    "Avatar",
    "AvatarsResponse",
    "VideoTemplate",
    "VideoTemplatesResponse",
    "HeyGenVoicesResponse",
    # Documents (Rust SDK names)
    "ChunkRequest",
    "DocumentChunk",
    "ChunkResponse",
    "ProcessRequest",
    "ProcessResponse",
    # Jobs (Rust SDK names)
    "JobCreateRequest",
    "JobSummary",
    # Batch
    "BatchJob",
    # RAG (Rust SDK names)
    "RagSearchRequest",
    "RagResult",
    "RagSearchResponse",
    "RagCorpus",
    "SurrealRagSearchRequest",
    "SurrealRagResult",
    "SurrealRagSearchResponse",
    "SurrealRagProvider",
    "SurrealRagProvidersResponse",
    # Error types
    "ApiError",
    "Error",
    # Credits
    "CreditPurchaseRequest",
    "DevProgramApplyRequest",
    "CreditTier",
    # Auth
    "AuthAppleRequest",
    # Response Meta
    "ResponseMeta",
    # 3D Mesh
    "RemeshRequest",
    "ModelUrls",
    "RetextureRequest",
    "RigRequest",
    "AnimationPostProcess",
    "AnimateRequest",
    # --- New types for cross-SDK parity ---
    "Citation",
    "AlignedWord",
    "DialogueResponse",
    "DubResponse",
    "SpeechToSpeechResponse",
    "IsolateVoiceResponse",
    "RemixVoiceResponse",
    "VoicePreview",
    "StarfishTTSResponse",
    "IsolateVoiceRequest",
    "RemixVoiceRequest",
    "MusicAdvancedClip",
    "MusicAdvancedRequest",
    "MusicAdvancedResponse",
    "MusicFinetuneCreateRequest",
    "CollectionDocumentsResponse",
    "CollectionSearchResponse",
    "CollectionsListResponse",
    "CreateCollectionRequest",
    "DeleteCollectionResponse",
    "Discussion",
    "Infobox",
    "ModelsResponse",
    "RagCorporaResponse",
    "SurrealRagProviderInfo",
    "TextToSpeechRequest",
    "TextToSpeechResponse",
    "SpeechToTextRequest",
    "SpeechToTextResponse",
]

__version__ = "0.3.0"
