package com.xunhong.erp.turbo.api.user.dto.cmd;

import com.xunhong.erp.turbo.base.annotation.Decrypt;
import com.xunhong.erp.turbo.base.dto.Command;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@Schema(title = "重置密码")
@EqualsAndHashCode(callSuper = true)
public class UpdatePasswordCmd extends Command {

	@Decrypt
	@Schema(title = "旧密码", requiredMode = Schema.RequiredMode.REQUIRED, type = "string")
	private String oldPassword;

	@Decrypt
	@Schema(title = "新密码", requiredMode = Schema.RequiredMode.REQUIRED, type = "string")
	@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$", message = "密码必须至少8个字符，包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")
	private String password;

	@Decrypt
	@Schema(title = "确认新密码", requiredMode = Schema.RequiredMode.REQUIRED, type = "string")
	@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$", message = "密码必须至少8个字符，包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")
	private String confirmPassword;

	@Schema(title = "验证码 token", hidden = true)
	private String token;

	@Schema(title = "用户id", hidden = true)
	private Long userId;
}
