package com.greenorange.promotion.model.dto.userInfo;

import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * 用户信息重置请求体
 */
@Data
@Schema(description = "小程序用户信息重置请求体", requiredProperties =
{"phoneNumber", "verificationCode", "userPassword", "userConfirmPassword, userRole"})
public class UserInfoResetRequest implements Serializable {

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    @Schema(description = "手机号", example = "15888610253")
    private String phoneNumber;

    /**
     * 验证码
     */
    @NotBlank(message = "验证码不能为空")
    @Schema(description = "验证码", example = "666999")
    private String verificationCode;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 10, message = "密码长度在 6 到 10 个字符")
    @Schema(description = "密码（建议加密存储）", example = "qingcheng")
    private String userPassword;

    /**
     * 确认密码
     */
    @NotBlank(message = "确认密码不能为空")
    @Size(min = 6, max = 10, message = "密码长度在 6 到 10 个字符")
    @Schema(description = "确认密码（建议加密存储）", example = "qingcheng")
    private String userConfirmPassword;

    /**
     * token(内部重置使用）
     */
    @Schema(description = "token（内部重置使用）", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTY5MjE5MzE5NywiZXhwIjoxNjkyMTk3Nzk3fQ.Q_5Y5Z")
    private String sourceToken;

    /**
     * 权限
     */
    @NotBlank(message = "权限不能为空")
    @EnumValue(enumClass = UserRoleEnum.class)
    @Schema(description = "权限", example = "user")
    private String userRole;

    @Serial
    private static final long serialVersionUID = 1L;
}
