package com.xkrs.model.qo;

import com.xkrs.model.validation.SysUserQoInsert;
import com.xkrs.model.validation.SysUserQoUpdate;
import org.hibernate.validator.constraints.Range;

import javax.persistence.Column;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * SysUserQo
 * @author tajochen
 */
public class SysUserQo {

    @NotNull( message = "{SysUser.id.blank}",groups={SysUserQoUpdate.class})
    private Integer id;

    @NotBlank(message = "{SysUser.userName.blank}",groups={SysUserQoInsert.class})
    @Size(min = 4,max = 16, message = "{SysUser.userName.length.illegal}",groups = {SysUserQoInsert.class,
            SysUserQoUpdate.class})
    @Pattern(regexp = "^([A-Za-z0-9_]+)$",message = "{SysUser.userName.format.illegal}",groups = {SysUserQoInsert.class,
            SysUserQoUpdate.class})
    private String userName;

    @Size(max = 32, message = "{SysUser.nickName.length.illegal}",groups = {SysUserQoInsert.class,
            SysUserQoUpdate.class})
    private String nickName;

    @NotBlank(message = "{SysUser.password.blank}",groups = {SysUserQoInsert.class})
    @Size(min = 6,max = 16, message = "{SysUser.password.length.illegal}",groups = {SysUserQoInsert.class,
            SysUserQoUpdate.class})
    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "{SysUser.password.format.illegal}",
            groups = {SysUserQoInsert.class,SysUserQoUpdate.class})
    private String password;

    @Pattern(regexp = "^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\\d{8}$",
            message = "{SysUser.telephone.format.illegal}",groups = {SysUserQoInsert.class,SysUserQoUpdate.class})
    private String telephone;

    @NotNull(message = "{SysUser.statusCode.illegal}",groups={SysUserQoUpdate.class})
    @Range(min=0,max=2,message = "{SysUser.statusCode.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class})
    private Integer statusCode;

    @NotNull(message = "{SysUser.deleteFlag.null}",groups={SysUserQoUpdate.class})
    private Integer deleteFlag;

    /**
     * 省
     */
    @NotNull(message = "{SysUser.province.illegal}",groups={SysUserQoUpdate.class})
    private String province;

    /**
     * 市
     */
    @NotNull(message = "{SysUser.city.illegal}",groups={SysUserQoUpdate.class})
    private String city;

    /**
     * 区
     */
    @NotNull(message = "{SysUser.county.illegal}",groups={SysUserQoUpdate.class})
    private String county;

    private Integer roleId;

    private Integer authorityId;

    private String identity;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Integer getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public Integer getAuthorityId() {
        return authorityId;
    }

    public void setAuthorityId(Integer authorityId) {
        this.authorityId = authorityId;
    }

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }
}
