from dynamix_sdk import config
from .api import API


class Dynamix:
    _config: config.ConfigWithAuth

    def __init__(
        self,
        *,
        url: str,
        auth: str | config.AuthenticatorProtocol,
        verify_ssl: bool = True,
        http503_attempts: int = 10,
        http503_attempts_interval: int = 5,
        result_extra_allow: bool = False,
    ):
        self._config = config.ConfigWithAuth(
            base_api_path='/restmachine',
            url=url,
            auth=auth,
            verify_ssl=verify_ssl,
            http503_attempts=http503_attempts,
            http503_attempts_interval=http503_attempts_interval,
            result_extra_allow=result_extra_allow,
        )

    @property
    def api(self):
        return API(config=self._config)
