package cz.muni.disa.adamiss.se.stats.objects;

import java.util.Collections;
import java.util.List;

public record DBReport(
        int size,
        int uniqueItems,
        int minLength,
        float avgLength,
        int maxLength,
        int minRepeatibility,
        float avgRepeatibility,
        int maxRepeatibility,
        float avgRepeatedItems,
        List<Integer> uniqueItemDistribution
) {
    public DBReport {
        Collections.sort(uniqueItemDistribution, Collections.reverseOrder());
        uniqueItemDistribution = List.copyOf(uniqueItemDistribution);
    }

    public String toCSV() {
        return this.size() + "," +
                this.uniqueItems() + "," +
                this.avgLength() /**+ "," +
         "\"" + this.uniqueItemDistribution().stream().map(item -> item.toString()).collect(Collectors.joining(",")) + "\""**/;
    }
}
