from importlib.metadata import version as _version

from upbeat._auth import Credentials
from upbeat._client import AsyncUpbeat, Upbeat
from upbeat._config import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, Timeout, UpbeatConfig
from upbeat._constants import (
    API_BASE_URL,
    WS_PRIVATE_URL,
    WS_PUBLIC_URL,
    MarketState,
    OrderSide,
    OrderState,
    OrderType,
    SortOrder,
    TimeInForce,
    get_krw_tick_size,
    round_to_tick,
)
from upbeat._convenience import (
    get_candles,
    get_candles_df,
    get_markets,
    get_orderbook,
    get_orderbooks,
    get_ticker,
    get_tickers,
    get_trades,
)
from upbeat._errors import (
    APIConnectionError,
    APIError,
    APIStatusError,
    APITimeoutError,
    AuthenticationError,
    BadRequestError,
    InsufficientFundsError,
    InternalServerError,
    MinimumOrderError,
    NotFoundError,
    PermissionDeniedError,
    RateLimitError,
    RemainingRequest,
    UnprocessableEntityError,
    UpbeatError,
    WebSocketClosedError,
    WebSocketConnectionError,
    WebSocketError,
)
from upbeat._logger import (
    DefaultLogger,
    ErrorInfo,
    Logger,
    NullLogger,
    RequestInfo,
    ResponseInfo,
    RetryInfo,
    WebSocketEventInfo,
)
from upbeat.types.common import APIResponse
from upbeat.ws import (
    AsyncUpbeatWebSocket,
    CandleMessage,
    MyAssetItem,
    MyAssetMessage,
    MyOrderMessage,
    OrderbookMessage,
    OrderbookUnitMessage,
    TickerMessage,
    TradeMessage,
    WebSocketConnection,
    WebSocketMessage,
    generate_multi_payload,
    generate_payload,
    parse_message,
)

__version__ = _version("upbeat")

__all__ = [
    # Version
    "__version__",
    # Client
    "AsyncUpbeat",
    "Upbeat",
    # Auth
    "Credentials",
    # Types
    "APIResponse",
    # Config
    "DEFAULT_MAX_RETRIES",
    "DEFAULT_TIMEOUT",
    "Timeout",
    "UpbeatConfig",
    # Constants
    "API_BASE_URL",
    "WS_PRIVATE_URL",
    "WS_PUBLIC_URL",
    "MarketState",
    "OrderSide",
    "OrderState",
    "OrderType",
    "SortOrder",
    "TimeInForce",
    "get_krw_tick_size",
    "round_to_tick",
    # Logger
    "DefaultLogger",
    "ErrorInfo",
    "Logger",
    "NullLogger",
    "RequestInfo",
    "ResponseInfo",
    "RetryInfo",
    "WebSocketEventInfo",
    # Convenience functions
    "get_candles",
    "get_candles_df",
    "get_markets",
    "get_orderbook",
    "get_orderbooks",
    "get_ticker",
    "get_tickers",
    "get_trades",
    # Errors
    "APIConnectionError",
    "APIError",
    "APIStatusError",
    "APITimeoutError",
    "AuthenticationError",
    "BadRequestError",
    "InsufficientFundsError",
    "InternalServerError",
    "MinimumOrderError",
    "NotFoundError",
    "PermissionDeniedError",
    "RateLimitError",
    "RemainingRequest",
    "UnprocessableEntityError",
    "UpbeatError",
    "WebSocketClosedError",
    "WebSocketConnectionError",
    "WebSocketError",
    # WebSocket
    "AsyncUpbeatWebSocket",
    "CandleMessage",
    "MyAssetItem",
    "MyAssetMessage",
    "MyOrderMessage",
    "OrderbookMessage",
    "OrderbookUnitMessage",
    "TickerMessage",
    "TradeMessage",
    "WebSocketConnection",
    "WebSocketMessage",
    "WS_PRIVATE_URL",
    "WS_PUBLIC_URL",
    "generate_multi_payload",
    "generate_payload",
    "parse_message",
]
