package cn.estsh.i3plus.ext.mes.pojo.model.bu3;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @DESCRIPTION:
 * @USER: wangjie
 * @DATE: 2022-11-01 15:54
 */
@Data
@ApiModel("综合能率分析报表数据MODEL")
public class SxEnergyCompositeRateAnalysisModel extends SxEChartsReportCommonDataModel implements Serializable {

    private static final long serialVersionUID = 3868119882567899155L;

    @ApiParam(value = "事业别代码")
    private String careerCodeArr;

    @ApiParam(value = "事业别名称")
    private String careerNameArr;

    @ApiParam("产品别代码")
    private String categoryCodeArr;

    @ApiParam(value = "产品别名称")
    private String categoryNameArr;

    @ApiParam("事业别代码集合")
    private Map<String, String> careerMap;

    @ApiParam("产品别代码集合")
    private Map<String, String> categoryMap;

    @ApiParam("月度集合")
    private Map<String, String> monthMap;

    @ApiParam(value = "标题")
    private String title;

    @ApiParam("柱状图能率数据")
    private List<SxDataModel> barDataList;

    @ApiParam("折线图目标数据")
    private List<SxDataModel> lineDataList;

    @ApiParam("数据集")
    private List<SxEnergyCompositeRateAnalysisModel> analysisDataList;

    public SxEnergyCompositeRateAnalysisModel careerMap(Map<String, String> careerMap) {
        this.careerMap = careerMap;
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel categoryMap(Map<String, String> categoryMap) {
        this.categoryMap = categoryMap;
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel putMonthMap(String key, String value) {
        if (CollectionUtils.isEmpty(this.monthMap)) this.monthMap = new LinkedHashMap<>();
        monthMap.put(key, value);
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel title(String title) {
        this.title = title;
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel addLineData(String key, BigDecimal value, BigDecimal value2, BigDecimal value3) {
        if (CollectionUtils.isEmpty(this.lineDataList)) this.lineDataList = new LinkedList<>();
        this.lineDataList.add(new SxDataModel(key, value, value2, value3));
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel addLineData(String key, BigDecimal value) {
        if (CollectionUtils.isEmpty(this.lineDataList)) this.lineDataList = new LinkedList<>();
        this.lineDataList.add(new SxDataModel(key, value, value, value));
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel addBarData(String key, BigDecimal value, BigDecimal value2, BigDecimal value3) {
        if (CollectionUtils.isEmpty(this.barDataList)) this.barDataList = new LinkedList<>();
        this.barDataList.add(new SxDataModel(key, value, value2, value3));
        return this;
    }

    public SxEnergyCompositeRateAnalysisModel addAnalysisData(SxEnergyCompositeRateAnalysisModel analysisData) {
        if (CollectionUtils.isEmpty(this.analysisDataList)) this.analysisDataList = new LinkedList<>();
        this.analysisDataList.add(analysisData);
        return this;
    }

}
