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.util.LinkedList;
import java.util.List;

/**
 * @DESCRIPTION:
 * @USER: wangjie
 * @DATE: 2022-11-01 15:54
 */
@Data
@ApiModel("作业时间月绩报表数据MODEL")
public class SxWorkingTimeMonthlyPerformanceModel extends SxEChartsReportCommonDataModel implements Serializable {

    private static final long serialVersionUID = -5305346677254136752L;

    @ApiParam("无差别标志")
    public String unGroupByDate;

    @ApiParam("数据维度")
    public Integer dimension1;

    @ApiParam("产品类别")
    private String categoryCode3;

    @ApiParam("表字段")
    private List<SxDataModel> tableNameList;

    @ApiParam("表数据")
    private List<SxWorkingTimeMonthlyPerformanceDetailModel> tableDataList;

    public SxWorkingTimeMonthlyPerformanceModel addTableName(String field, String name) {
        if (CollectionUtils.isEmpty(this.tableNameList)) this.tableNameList = new LinkedList<>();
        this.tableNameList.add(new SxDataModel(field, name));
        return this;
    }

    public SxWorkingTimeMonthlyPerformanceModel addTableData(SxWorkingTimeMonthlyPerformanceDetailModel tableData) {
        if (CollectionUtils.isEmpty(this.tableDataList)) this.tableDataList = new LinkedList<>();
        this.tableDataList.add(tableData);
        return this;
    }

}
