"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""


from ._hooks import SDKHooks
from .httpclient import AsyncHttpClient, HttpClient
from .utils import RetryConfig, remove_suffix
from dataclasses import dataclass
from dub.models import components, internal
from dub.types import Nullable, UNSET
from typing import Callable, Dict, Optional, Tuple, Union


SERVERS = [
    "https://api.dub.co",
    # Production API
]
"""Contains the list of servers available to the SDK"""

@dataclass
class SDKConfiguration:
    client: HttpClient
    async_client: AsyncHttpClient
    globals: internal.Globals
    security: Optional[Union[components.Security,Callable[[], components.Security]]] = None
    server_url: Optional[str] = ""
    server_idx: Optional[int] = 0
    language: str = "python"
    openapi_doc_version: str = "0.0.1"
    sdk_version: str = "0.0.19"
    gen_version: str = "2.359.6"
    user_agent: str = "speakeasy-sdk/python 0.0.19 2.359.6 0.0.1 dub"
    retry_config: Optional[Nullable[RetryConfig]] = UNSET

    def __post_init__(self):
        self._hooks = SDKHooks()

    def get_server_details(self) -> Tuple[str, Dict[str, str]]:
        if self.server_url is not None and self.server_url:
            return remove_suffix(self.server_url, "/"), {}
        if self.server_idx is None:
            self.server_idx = 0

        return SERVERS[self.server_idx], {}


    def get_hooks(self) -> SDKHooks:
        return self._hooks
