package jnpf.model.personnels.dto.resignation;

import jnpf.model.personnels.po.FtbPersonnelsResignationCategoryConfiguration;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

@Data
public class FtbResignationConfigurationCategoryDTO {

    private String id;

    /**
     * 离职原因类别
     */
    @NotBlank(message = "离职原因类别不能为空")
    @Length(max = 10, message = "离职原因类别长度不能超过10")
    private String resignationTypeName;

    /**
     * 类型(1 系统默认 2 自定义)
     */
    private Integer type;

    /**
     *是否选中，0选中,1未选中
     */
    private Integer checked;

    public static FtbPersonnelsResignationCategoryConfiguration covert(FtbResignationConfigurationCategoryDTO dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsResignationCategoryConfiguration ftbPersonnelsResignationCategoryConfiguration = new FtbPersonnelsResignationCategoryConfiguration();
        ftbPersonnelsResignationCategoryConfiguration.setId(dto.getId());
        if (dto.getResignationTypeName() != null) ftbPersonnelsResignationCategoryConfiguration.setResignationTypeName(dto.getResignationTypeName());
        ftbPersonnelsResignationCategoryConfiguration.setType(dto.getType());
        ftbPersonnelsResignationCategoryConfiguration.setChecked(dto.getChecked());
        return ftbPersonnelsResignationCategoryConfiguration;
    }

}
