import os


def get_config():
    return Config()


class Config:
    def __init__(self):
        self.logging_level_root = os.environ.get("LOGGING_LEVEL_ROOT", "INFO")
        self.table_parsing_skip_pages_without_images = os.environ.get("TABLE_PARSING_SKIP_PAGES_WITHOUT_IMAGES", True)

        # visual_logging_level: NOTHING > INFO > DEBUG > ALL
        self.visual_logging_level = "DISABLED"
        self.visual_logging_output_folder = "/tmp/debug"

        # locations
        # FIXME: is everything here necessary?
        root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        self.dvc_data_dir = os.path.join(root, "data")
        self.pdf_for_testing = os.path.join(self.dvc_data_dir, "pdfs_for_testing")
        self.png_for_testing = os.path.join(self.dvc_data_dir, "pngs_for_testing")
        self.png_figures_detected = os.path.join(self.png_for_testing, "figures_detected")
        self.png_tables_detected = os.path.join(self.png_for_testing, "tables_detected_by_tp")
        self.hashed_pdfs_for_testing = os.path.join(self.pdf_for_testing, "hashed")
        self.metadata_test_files = os.path.join(self.dvc_data_dir, "metadata_testing_files.csv")
        self.test_dir = os.path.join(root, "test")
        self.test_data_dir = os.path.join(self.test_dir, "test_data")

    def __getitem__(self, key):
        return self.__getattribute__(key)
