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

import cn.reghao.jutil.jdk.web.validator.ValidEnum;
import cn.reghao.tnb.auth.app.model.constant.VerifyChannel;
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-14 16:55:03
 */
@Getter
@Setter
public class VerifyCodeDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ValidEnum(value = VerifyChannel.class, message = "验证码通道类型错误")
    private Integer channel;
    /*@NotBlank(message = "邮箱或手机号不能为空白字符串")
    @Size(min = 1, max = 64, message = "帐号长度不应超过 64 个字符")*/
    @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 = "手机号格式不正确")
    private String receiver;
}
