package jnpf.model.personnels.dto.rewardspunishments;

import jnpf.model.personnels.po.FtbPersonnelsRewardsPunishments;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

@Data
public class FtbPersonnelsRewardsPunishmentsAddDTO {

    /**
     * 规则名称
     */
    @NotBlank(message = "规则名称不能为空")
    @Size(max = 20, message = "规则名称长度不能超过20")
    private String regularName;

    /**
     * 金额
     */
    @NotNull(message = "金额不能为空")
    private BigDecimal money;

    /**
     * 类型，0奖励，1惩罚
     */
    @NotNull(message = "类型不能为空")
    private Integer type;

    /**
     * 是否记入员工档案,0否1是
     */
    @NotNull(message = "是否记入员工档案不能为空")
    private Integer isRecorded;

    public static FtbPersonnelsRewardsPunishments convertFtbPersonnelsRewardsPunishments(FtbPersonnelsRewardsPunishmentsAddDTO ftbPersonnelsRewardsPunishmentsAddDTO) {
        if (ftbPersonnelsRewardsPunishmentsAddDTO == null) {
            return null;
        }
        FtbPersonnelsRewardsPunishments ftbPersonnelsRewardsPunishments = new FtbPersonnelsRewardsPunishments();
        ftbPersonnelsRewardsPunishments.setRegularName(ftbPersonnelsRewardsPunishmentsAddDTO.getRegularName());
        ftbPersonnelsRewardsPunishments.setMoney(ftbPersonnelsRewardsPunishmentsAddDTO.getMoney());
        ftbPersonnelsRewardsPunishments.setType(ftbPersonnelsRewardsPunishmentsAddDTO.getType());
        ftbPersonnelsRewardsPunishments.setIsRecorded(ftbPersonnelsRewardsPunishmentsAddDTO.getIsRecorded());
        return ftbPersonnelsRewardsPunishments;
    }

}
