package com.changhu.common.validator.annotation;

import com.changhu.common.validator.OnlyInValueValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * author: luozhun
 * desc: 只能为定义的值 比如[1,0]
 * createTime: 2023/8/22 9:41
 */
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
        validatedBy = {
                OnlyInValueValidator.class
        }
)
public @interface OnlyInValue {
    boolean required() default true;

    String message() default "必须为指定值";

    String[] strValues() default {};

    int[] intValues() default {};

    Class<?>[] groups() default {};

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