package com.ruoyi.common.core.annotation;

import com.ruoyi.common.core.constraints.EnumValidator;
import com.ruoyi.common.core.enums.BaseValidEnum;
import com.ruoyi.common.core.constraints.EnumValidator;

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

/**
 * @Description: 枚举校验
 * @Author: wenhao
 * @Create: 2022/08/15 11:12
 * @Version: 1.0
 */
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = EnumValidator.class)
@Documented
public @interface EnumValid {

    String message() default "枚举不符合规范";

    Class<? extends BaseValidEnum> enumClass();

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

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

}
