package com.r11.tools.model.constraints;

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

/**
 * Annotation interface that is used to annotate Integer fields that contain http status values.
 * It provides validation and throws an error when trying to send response with incorrect status.
 * @author Rafał Żukowicz
 */
@Target({ ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = HttpCodeValidation.class )
public @interface HttpCode {
    String message() default "must be a valid http code";

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