package com.hdkj.lt.base.annotations;

import com.hdkj.lt.base.constraints.DateTimeValidator;
import cn.hutool.core.date.DatePattern;

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;

/**
 * @Description: 日期时间字符串校验
 * @Author: wenhao
 * @Create: 2021/10/20 11:12
 * @Version: 1.0
 */
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = DateTimeValidator.class)
public @interface DateTimeValid {

    String message() default "format incorrect";

    String format() default DatePattern.NORM_DATETIME_PATTERN;

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

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

}
