package com.ff.validation;

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 shi
 * @date 2025/02/12
 */
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ListSizeValidator.class)
public @interface ListSizeCheck {

    /**
     * 消息
     *
     * @return {@link String }
     */
    String message() default "列表不能为空，且大小不得超过200";

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

    /**
     * 有效载荷
     *
     * @return {@link Class }<{@link ? } {@link extends } {@link Payload }>{@link [] }
     */
    Class<? extends Payload>[] payload() default {};

    /**
     * 最大尺寸
     *
     * @return int
     */
    int maxSize() default 200;
}