package com.r11.tools.configuration;

import com.r11.tools.interceptor.IncomingMockRequestInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Configuration for {@link IncomingMockRequestInterceptor}
 *
 * @author Mikołaj Widła
 */

@Configuration
@AllArgsConstructor
public class WebConfig implements WebMvcConfigurer{

    private final IncomingMockRequestInterceptor requestInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor( requestInterceptor )
                .addPathPatterns("/api/mock/r/**");
    }

}
