"""apimaticcalculator.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from apimatic_core.configurations.global_configuration import (
    GlobalConfiguration,
)
from apimatic_core.decorators.lazy_property import (
    LazyProperty,
)

from apimaticcalculator.apis.base_api import (
    BaseApi,
)
from apimaticcalculator.apis.simple_calculator_api import (
    SimpleCalculatorApi,
)
from apimaticcalculator.configuration import (
    Configuration,
    Environment,
)


class ApimaticcalculatorClient(object):
    """Client that provide access to the ApimaticcalculatorClient APIs."""

    @LazyProperty
    def simple_calculator(self):
        """Provide access to the SimpleCalculatorApi endpoints."""
        return SimpleCalculatorApi(self.global_configuration)

    def __init__(self, http_client_instance=None,
                 override_http_client_configuration=False, http_call_back=None,
                 timeout=30, max_retries=0, backoff_factor=2,
                 retry_statuses=None, retry_methods=None, proxy_settings=None,
                 logging_configuration=None, environment=Environment.PRODUCTION,
                 config=None):
        """Initialize a new instance of ApimaticcalculatorClient."""
        self.config = config or Configuration(
            http_client_instance=http_client_instance,
            override_http_client_configuration=override_http_client_configuration,
            http_call_back=http_call_back, timeout=timeout,
            max_retries=max_retries, backoff_factor=backoff_factor,
            retry_statuses=retry_statuses, retry_methods=retry_methods,
            proxy_settings=proxy_settings,
            logging_configuration=logging_configuration,
            environment=environment)

        self.global_configuration = GlobalConfiguration(self.config)\
            .global_errors(BaseApi.global_errors())\
            .base_uri_executor(self.config.get_base_uri)\
            .user_agent(BaseApi.user_agent(),
                BaseApi.user_agent_parameters())

    @classmethod
    def from_environment(cls, dotenv_path=None, **overrides):
        """Create a client instance using environment variables.

        Returns:
            ApimaticcalculatorClient instance.

        """
        return cls(config=Configuration
            .from_environment(dotenv_path=dotenv_path, **overrides))
