from pathlib import Path

from .environment import Environment


class Configuration(object):
    def __init__(self, environment: Environment, key: str,
                 secret: str, client_id: int = 1, timeout: int = 30, download_dir: str = None):
        self._environment = environment
        self._key = key
        self._secret = secret
        self._client_id = client_id
        self._timeout = timeout
        self._download_path = download_dir

        if self._download_path is not None:
            Path(self._download_path).mkdir(parents=True, exist_ok=True)

    @property
    def environment(self) -> Environment:
        return self._environment

    @property
    def key(self) -> str:
        return self._key

    @property
    def secret(self) -> str:
        return self._secret

    @property
    def client_id(self):
        return self._client_id

    @property
    def timeout(self) -> int:
        return self._timeout

    @property
    def download_path(self) -> str:
        return self._download_path
