package cn.reghao.tnb.auth.app.model.dto;

import cn.reghao.tnb.auth.app.model.constant.LoginPlat;
import lombok.Getter;
import lombok.Setter;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.io.Serializable;

/**
 * 用户注册提交的数据
 *
 * @author reghao
 * @date 2021-11-17 16:36:05
 */
@Setter
@Getter
public class AccountRegisterDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @NotBlank
    @Size(min = 11, max = 11, message = "手机号长度应为 11 个字符")
    @Pattern(regexp = "^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$", message = "手机号格式不正确")
    // UserAccount 中的 mobile
    private String principal;
    @NotBlank
    @Size(min = 1, max = 1024)
    // 经 rsa 公钥加密后的密码
    private String credential;
    @NotBlank
    @Size(min = 6, max = 6, message = "验证码长度应为 6 个字符")
    private String verifyCode;
    @NotBlank
    @Size(min = 5, max = 5, message = "图形验证码长度应为 5 个字符")
    private String captchaCode;
    private String plat;

    public AccountRegisterDto() {
        this.plat = LoginPlat.web.getName();
    }
}
