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

import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum;
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 java.util.Date;

/**
 * 个税扣缴义务人调整保存参数
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//个税扣缴义务人调整保存参数")
public class SalaryArchiveTaxAgentSaveParam {

    //薪资档案id")
    private Long salaryArchiveId;

    //生效时间")
    private Date effectiveTime;

    /**
     * 调整原因
     * @see SalaryArchiveTaxAgentAdjustReasonEnum
     */
    private String adjustReason;

    //个税扣缴义务人id")
    private Long taxAgentId;

    public static void checkParam(SalaryArchiveTaxAgentSaveParam saveParam) {
        if (saveParam.getSalaryArchiveId() == null) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100305, "薪资档案id必传"));
        }
        if (saveParam.getAdjustReason() == null) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100306, "请选择调整原因"));
        }
        if (saveParam.getEffectiveTime() == null) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100307, "请选择生效日期"));
        }
        if (saveParam.getTaxAgentId() == null) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100313, "请选择调整后的个税扣缴义务人"));
        }
    }
}
