package com.engine.salary.report.entity.param;

import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryI18nUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 薪酬统计报表保存参数
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//"薪酬统计报表保存参数")
public class SalaryStatisticsReportSaveParam {

    //薪酬统计报表主键id")
    private Long id;

    // 薪酬统计报表名称")
    private String reportName;

    // 统计维度id")
    private List<Long> dimensionIds;


    public static void checkParam(SalaryStatisticsReportSaveParam saveParam) {
        if (StringUtils.isEmpty(saveParam.getReportName())) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 161842, "统计报表名称必填"));
        }
        saveParam.setReportName(saveParam.getReportName().trim());
        if (CollectionUtils.isEmpty(saveParam.getDimensionIds())) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 161843, "统计维度必传"));
        }
    }
}
