#pragma once

#include <vector>
#include <string>
#include "DataGroup.hpp"

/*
   Class: DataSet

     Implements a set of data groups with a common name.
*/
class DataSet {
  public:
    /*
       Constructor: DataSet

         Initializes the object.

       Parameters:

         sName - Name of the data set for display in the chart headline.
         sUnit - Name of the unit of the values (e.g. "Percentage") for display at the vertical chart axis.
    */
    DataSet(std::string sName, std::string sUnit);

    /*
       Destructor: ~DataSet

         Releases all allocated resources.
    */
    ~DataSet();


    /*
       Function: AddDataGroup

         Adds the data group to the data set.

       Parameters:

         pDataGroup - The data group to be added.
    */
    void AddDataGroup(DataGroup* pDataGroup);

    /*
       Function: GetName

         Returns the name of the data set.

       Returns:

         The name of the data set.
    */
    std::string GetName();

    /*
       Function: GetUnit

         Returns the unit of the data values.

       Returns:

         The unit of the data values.
    */
    std::string GetUnit();

    /*
       Function: GetHighestGroupValue

         Returns the highest summed value among all data groups of the data set.

       Returns:

         The highest summed value among all data groups of the data set.
    */
    double GetHighestGroupValue();

    /*
       Function: GetAllDataEntries

         Returns a vector containing the data entries of all data groups.

       Returns:

         A vector containing the data entries of all data groups.
    */
    std::vector<DataEntry*> GetAllDataEntries();

    /*
       Function: GetDataGroups

         Returns a vector containing the data groups of the data set.

       Returns:

         A vector containing the data groups of the data set.
    */
    std::vector<DataGroup*> GetDataGroups();

    /*
       Function: SetSortingOrder

         Sorts the data set according to the parameter either descending or ascending.

       Parameters:

         bDescending - Indicates if the data set is sorted descending (true) or ascending (false).
    */
    void SetSortingOrder(bool bDescending);

    /*
       Function: GetSortingOrder

         Returns a boolean value indicating the sorting order of the data set. If the sorting order is 'descending', true is returned, else false.

       Returns:

         A boolean value indicating the sorting order of the data set.
    */
    bool GetSortingOrder();

    /*
       Function: SetFiltering

         Filters the data set according to the parameter. If true, all elements are shown, else only the <FILTER_SIZE> biggest elements are shown and the rest is filtered.

       Parameters:

         bShowAll - Indicates if all data entries are shown (true) or if the filtering is applied (false).
    */
    void SetFiltering(bool bShowAll);

    /*
       Function: GetFiltering

         Returns a boolean value indicating the filtering behavior of the data set. If the filtering is set to 'show all', true is returned, else false.

       Returns:

         A boolean value indicating the filtering behavior of the data set.
    */
    bool GetFiltering();

  private:
    std::string sName;
    std::string sUnit;
    std::vector<DataGroup*> vDataGroups;
    bool bDescending;
    bool bShowAll;
};