package com.mosty.base.annot;

import com.mosty.base.annot.validation.DictValidation;

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

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author zhangzhao
 * @description 校验是否是字典 注解
 * @modifier zhangzhao
 * @modifiedTime 2023/3/17 17:40
 * @since 2023/3/17 17:40
 */
@Documented
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
@Constraint(validatedBy = {DictValidation.class})
public @interface IsDict {

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

    /**
     * 错误提示信息
     * @return 错误提示信息
     */
    String message() default "dict.not.standard";

    /**
     * 字典编号
     * @return 字典编号
     */
    String zdbh() default "";

    /**
     * 是否必填，默认为必填
     * @return 是否
     */
    boolean isNotBlank() default true;

}
