package cn.lihongjie.coal.validator;

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

import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;
import java.lang.annotation.Documented;

@Target({ TYPE, ANNOTATION_TYPE, TYPE_USE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = UniqValidator.class)
@Documented
@Repeatable(Uniq.List.class)
public @interface Uniq {

    String message() default "{uniq.default}";


    String[] fields()default  {} ;



    Class<?> entityClass() default Object.class;
    String entityName() default "";
    String idField() default "id";
    Class<?>[] groups() default { };

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


    @Target({ TYPE, ANNOTATION_TYPE, TYPE_USE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface List {
        Uniq[] value();
    }
}
