package com.gxwebsoft.common.system.param;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 重置密码参数
 *
 * @author WebSoft
 * @since 2025-12-12
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "重置密码参数")
public class ResetPasswordParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "手机号码（手机找回时必填）")
    private String phone;

    @Schema(description = "短信验证码（手机找回时必填）")
    private String smsCode;

    @Schema(description = "邮箱（邮箱找回时必填）")
    private String email;

    @Schema(description = "邮箱验证码（邮箱找回时必填）")
    private String emailCode;

    @Schema(description = "用户ID（未登录忘记密码场景可不传，后端按手机号查用户）")
    private String userId;

    @Schema(description = "租户ID（未登录忘记密码场景可不传）")
    private Integer tenantId;

    @NotBlank(message = "新密码不能为空")
    @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d@$!%*#?&]{8,}$",
             message = "密码必须至少8位,且包含字母和数字")
    @Schema(description = "新密码(至少8位,包含字母和数字)", required = true)
    private String newPassword;

    @NotBlank(message = "确认密码不能为空")
    @Schema(description = "确认密码", required = true)
    private String confirmPassword;

    @Schema(description = "短信模板ID（可选）")
    private Integer templateId;
}
