package com.crm.rely.backend.model.entity.user.info;

import com.crm.rely.backend.core.constant.Constants;
import com.crm.rely.backend.core.constant.ManagerConstant;
import com.crm.rely.backend.core.constant.RegexpConstants;
import com.crm.rely.backend.core.entity.base.BaseAddEntity;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @program: crm-backend
 * @description:
 * @author: houn
 * @create: 2019-07-30 17:01
 */
@Data
public class UserInfoAddEntity extends BaseAddEntity {

    @NotNull(message = Constants.NAME_NOT_NULL)
    @NotBlank(message = Constants.NAME_NOT_NULL)
    private String name;

    @NotNull(message = Constants.USERNAME_NOT_NULL_ERROR)
    @NotBlank(message = Constants.USERNAME_NOT_NULL_ERROR)
    private String username;

    @Pattern(regexp = RegexpConstants.REGEXP_PWD, message = Constants.PASSWORD_FORMAT_ERROR)
    @NotNull(message = Constants.PASSWORD_NOT_NULL_ERROR)
    @NotBlank(message = Constants.PASSWORD_NOT_NULL_ERROR)
    private String password;

    @Pattern(regexp = RegexpConstants.REGEXP_EMAIL, message = Constants.EMAIL_FORMAT_ERROR)
    @NotNull(message = Constants.EMAIL_NOT_NULL_ERROR)
    @NotBlank(message = Constants.EMAIL_NOT_NULL_ERROR)
    private String email;

    @NotNull(message = ManagerConstant.ROLE_NOT_NULL_ERROR)
    private Long roleId;

    private Integer userType;

    private String nationality;

    private Long groupId;

    private String ibNo;

    private Integer valid;

    private Long pid;

    /**
     * 是否ip限制 0否 1是
     */
    private Integer ipLimit;
    /**
     * 限制ip 如果不为空和null 则只有这个ip才能登录
     */
    private String limitIp;
}
