package ervu_dashboard.component.chart;

import java.util.Arrays;

import component.chart.dto.ChartConfigDto;
import component.chart.service.ChartV2Service;
import ervu_dashboard.model.chart.BarMockDatasets;
import model.Filter;

/**
 * @author Vitaly Chekushkin
 */
public class BarMockChartV2Service implements ChartV2Service {

  public BarMockDatasets datasetsConfiguration;

  @Override
  public ChartConfigDto loadData(Integer integer, Integer integer1, Filter[] filters) {
    ChartConfigDto chartConfigDto = new ChartConfigDto();
    datasetsConfiguration.labels = Arrays.stream(datasetsConfiguration.datasets)
        .flatMap(dataset -> Arrays.stream(dataset.data)).map(String::valueOf).toArray(String[]::new);
    chartConfigDto.setData(datasetsConfiguration);
    chartConfigDto.setType("bar");
    return chartConfigDto;
  }
}
