package com.ssyf.common.web.valid;


import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 数组元素校验
 * @author huwei
 * @date 2023/9/25 22:00
 */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ArrayElementValidator.class)
public @interface ArrayElement {
    /**
     * 校验正则
     * @return
     */
    String regexp();

    /**
     * 个数限制
     * @return
     */
     long size() default Long.MAX_VALUE;

    /**
     * 提示消息
     * @return
     */
    String message() default "Invalid phone number format";

    /**
     * 分组
     * @return
     */
    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}