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

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

/**
 * @author shenyifei
 */
@Data
@Schema(title = "账号密码登录请求")
@EqualsAndHashCode(callSuper = true)
public class PasswordLoginQry extends Query {

	@Size(min = 4, max = 20, message = "至少4个字符串，至多20个字符串")
	@Pattern(regexp = "^[\\w_-]{8,20}$")
	@NotBlank(message = "不能为空")
	@Schema(title = "登录账号", example = "18367831980")
	private String username;

	@Decrypt
	@NotBlank
	@Size(min = 8, max = 20)
	@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$", message = "密码必须至少8个字符，包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")
	@Schema(title = "登录密码", example = "18367831980")
	private String password;

	@Schema(title = "验证码 token")
	private String token;
}
