/*
 * The Exomiser - A tool to annotate and prioritize genomic variants
 *
 * Copyright (c) 2016-2022 Queen Mary University of London.
 * Copyright (c) 2012-2016 Charité Universitätsmedizin Berlin and Genome Research Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.monarchinitiative.exomiser.autoconfigure;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class ExomiserConfigReporter {

    private static final Logger logger = LoggerFactory.getLogger(ExomiserConfigReporter.class);

    public ExomiserConfigReporter(ExomiserProperties exomiserProperties) {

        var dataDir = propertyOrDefault(exomiserProperties.getDataDirectory(), "-");
        logger.info("exomiser.data-directory: {}", dataDir);

        var hg19Properties = exomiserProperties.getHg19();
        var hg19DataVersion = propertyOrDefault(hg19Properties.getDataVersion(), "-");
        logger.info("exomiser.hg19.data-version: {}", hg19DataVersion);

        var hg38Properties = exomiserProperties.getHg38();
        var hg38DataVersion = propertyOrDefault(hg38Properties.getDataVersion(), "-");
        logger.info("exomiser.hg38.data-version: {}", hg38DataVersion);

        var phenoProperties = exomiserProperties.getPhenotype();
        var phenoDataVersion = propertyOrDefault(phenoProperties.getDataVersion(), "-");
        logger.info("exomiser.phenotype.data-version: {}", phenoDataVersion);
    }

    private String propertyOrDefault(String property, String defaultValue) {
        return property.isEmpty() ? defaultValue : property;
    }

}

@@ -1002,16 +1002,65 @@
 actory;%0A
+import org.springframework.core.env.Environment;%0A
 import o
@@ -1319,16 +1319,41 @@
 operties
+, Environment environment
 ) %7B%0A%0A   
@@ -2165,16 +2165,223 @@
 ersion);
+%0A%0A        String cacheType = environment.getProperty(%22spring.cache.type%22);%0A        if (cacheType != null && !cacheType.equals(%22none%22)) %7B%0A            logger.info(%22spring.cache.type: %7B%7D%22, cacheType);%0A        %7D
 %0A    %7D%0A%0A

Update ExomiserConfigReporter to include cache type