package uk.ac.ebi.subs.api.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import uk.ac.ebi.subs.data.component.StudyDataType;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

@Component
@ConfigurationProperties("usi.studyDataType")
public class StudyDataTypeConfig {

    private boolean sequencingEnabled = true;
    private boolean sequencingAssemblyEnabled = true;
    private boolean sequencingVariationEnabled = true;
    private boolean sequencingSequenceAnnotation = true;

    private boolean functionalGenomicsEnabled = true;
    private boolean functionalGenomicsSequencing = true;
    private boolean functionalGenomicsArrays = true;

    private boolean metabolomicsEnabled = true;

    private boolean proteomicsEnabled = true;


    public Map<StudyDataType,Collection<String>> enabledDatatypes() {
        Map<StudyDataType,Collection<String>> enabledDataTypes = new TreeMap<>();

        if (sequencingEnabled) {
            Set<String> seqSubTypes = new TreeSet<>();
            if (sequencingAssemblyEnabled)
                seqSubTypes.add("Genome assemblies");

            if (sequencingSequenceAnnotation)
                seqSubTypes.add("Sequence annotation");

            if (sequencingVariationEnabled)
                seqSubTypes.add("Sequence variation");

            enabledDataTypes.put(StudyDataType.Sequencing, seqSubTypes);
        }

        if (metabolomicsEnabled) {
            enabledDataTypes.put(StudyDataType.Metabolomics, Collections.emptySet());
        }

        if (functionalGenomicsEnabled) {
            Set<String> seqSubTypes = new TreeSet<>();
            if (functionalGenomicsArrays)
                seqSubTypes.add("Microarrays");

            if (functionalGenomicsSequencing)
                seqSubTypes.add("Sequencing");

            enabledDataTypes.put(StudyDataType.FunctionalGenomics, seqSubTypes);
        }

        if (proteomicsEnabled) {
            enabledDataTypes.put(StudyDataType.Proteomics, Collections.emptySet());
        }

        return enabledDataTypes;
    }

    public boolean isSequencingAssemblyEnabled() {
        return sequencingAssemblyEnabled;
    }

    public void setSequencingAssemblyEnabled(boolean sequencingAssemblyEnabled) {
        this.sequencingAssemblyEnabled = sequencingAssemblyEnabled;
    }

    public boolean isSequencingVariationEnabled() {
        return sequencingVariationEnabled;
    }

    public void setSequencingVariationEnabled(boolean sequencingVariationEnabled) {
        this.sequencingVariationEnabled = sequencingVariationEnabled;
    }

    public boolean isSequencingSequenceAnnotation() {
        return sequencingSequenceAnnotation;
    }

    public void setSequencingSequenceAnnotation(boolean sequencingSequenceAnnotation) {
        this.sequencingSequenceAnnotation = sequencingSequenceAnnotation;
    }

    public boolean isSequencingEnabled() {
        return sequencingEnabled;
    }

    public void setSequencingEnabled(boolean sequencingEnabled) {
        this.sequencingEnabled = sequencingEnabled;
    }

    public boolean isMetabolomicsEnabled() {
        return metabolomicsEnabled;
    }

    public void setMetabolomicsEnabled(boolean metabolomicsEnabled) {
        this.metabolomicsEnabled = metabolomicsEnabled;
    }

    public boolean isFunctionalGenomicsEnabled() {
        return functionalGenomicsEnabled;
    }

    public void setFunctionalGenomicsEnabled(boolean functionalGenomicsEnabled) {
        this.functionalGenomicsEnabled = functionalGenomicsEnabled;
    }

    public boolean isProteomicsEnabled() {
        return proteomicsEnabled;
    }

    public void setProteomicsEnabled(boolean proteomicsEnabled) {
        this.proteomicsEnabled = proteomicsEnabled;
    }
}


@@ -29,16 +29,36 @@
 onfig;%0A%0A
+import lombok.Data;%0A
 import o
@@ -125,16 +125,16 @@
 erties;%0A
-
 import o
@@ -440,16 +440,22 @@
 aType%22)%0A
+@Data%0A
 public c
@@ -2208,32 +2208,32 @@
 ());%0A        %7D%0A%0A
+
         return e
@@ -2258,1699 +2258,8 @@
    %7D
-%0A%0A    public boolean isSequencingAssemblyEnabled() %7B%0A        return sequencingAssemblyEnabled;%0A    %7D%0A%0A    public void setSequencingAssemblyEnabled(boolean sequencingAssemblyEnabled) %7B%0A        this.sequencingAssemblyEnabled = sequencingAssemblyEnabled;%0A    %7D%0A%0A    public boolean isSequencingVariationEnabled() %7B%0A        return sequencingVariationEnabled;%0A    %7D%0A%0A    public void setSequencingVariationEnabled(boolean sequencingVariationEnabled) %7B%0A        this.sequencingVariationEnabled = sequencingVariationEnabled;%0A    %7D%0A%0A    public boolean isSequencingSequenceAnnotation() %7B%0A        return sequencingSequenceAnnotation;%0A    %7D%0A%0A    public void setSequencingSequenceAnnotation(boolean sequencingSequenceAnnotation) %7B%0A        this.sequencingSequenceAnnotation = sequencingSequenceAnnotation;%0A    %7D%0A%0A    public boolean isSequencingEnabled() %7B%0A        return sequencingEnabled;%0A    %7D%0A%0A    public void setSequencingEnabled(boolean sequencingEnabled) %7B%0A        this.sequencingEnabled = sequencingEnabled;%0A    %7D%0A%0A    public boolean isMetabolomicsEnabled() %7B%0A        return metabolomicsEnabled;%0A    %7D%0A%0A    public void setMetabolomicsEnabled(boolean metabolomicsEnabled) %7B%0A        this.metabolomicsEnabled = metabolomicsEnabled;%0A    %7D%0A%0A    public boolean isFunctionalGenomicsEnabled() %7B%0A        return functionalGenomicsEnabled;%0A    %7D%0A%0A    public void setFunctionalGenomicsEnabled(boolean functionalGenomicsEnabled) %7B%0A        this.functionalGenomicsEnabled = functionalGenomicsEnabled;%0A    %7D%0A%0A    public boolean isProteomicsEnabled() %7B%0A        return proteomicsEnabled;%0A    %7D%0A%0A    public void setProteomicsEnabled(boolean proteomicsEnabled) %7B%0A        this.proteomicsEnabled = proteomicsEnabled;%0A    %7D
 %0A%7D%0A%0A

trim down boilerplate