package com.backendsys.modules.system.entity;

import com.backendsys.entity.validator.Phone;
import jakarta.validation.constraints.*;
import lombok.Data;

@Data
public class SysAuthPhone {

    public static interface Login{}
    public static interface ForgotPassword{}
    public static interface Register{}
    public static interface Create{}
    public static interface Update{}

    private Long user_id;

    @NotEmpty(message="手机号码不能为空", groups = { Create.class, Register.class, Login.class, ForgotPassword.class })
    @Phone(message="手机号码格式不正确", groups = { Create.class, Update.class, Login.class, ForgotPassword.class })
    @Size(min = 9, max = 20, message = "手机号码长度在 {min}-{max} 字符", groups = { Create.class, Update.class, Login.class, ForgotPassword.class })
    private String phone;

    @NotNull(message="区号/国家码不能为空", groups = { Register.class, Login.class, ForgotPassword.class })
    @Max(value = 999999, message = "区号/国家码长度不超过 {value} 字符", groups = { Register.class })
    private Integer phone_area_code;

    @NotNull(message="验证码不能为空", groups = { Register.class, Login.class, ForgotPassword.class })
    @Min(value = 100000, message = "验证码长度是 6 位字符", groups = { Register.class })
    @Max(value = 999999, message = "验证码长度是 6 位字符", groups = { Register.class })
    private Integer phone_valid_code;

    private Integer is_remember;
}
