from cfgtools import read


class ConfiguratorReader:
    def __init__(self, loader_cfg, service_name, manager_name):
        self.service_name = service_name
        self.manager_name = manager_name

        self.reader = read(loader_cfg)

    def get_configuration(
        self,                  # type: ConfiguratorReader
        param,                 # type: str
        default_value="",      # type: str
    ):
        # type: (...) -> str

        value = self.reader.find_value(self.service_name + "." + self.manager_name + "." + param)
        if value is None:
            return default_value

        return value

    def get_configuration_list(self, param):
        return self.reader.find_values(self.service_name + "." + self.manager_name + "." + param)
