package com.atlassian.stash.internal.spring.mvc;

import com.atlassian.bitbucket.server.ApplicationMode;
import com.atlassian.stash.internal.mode.MirrorApplicationMode;
import com.atlassian.stash.internal.web.AboutController;
import com.atlassian.stash.internal.web.ErrorPageController;
import com.atlassian.stash.internal.web.auth.XsrfNotificationController;
import com.atlassian.stash.internal.web.mirror.MirrorController;
import com.atlassian.stash.internal.web.setup.SetupController;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

/**
 * The Spring MVC configuration to use when the application is in {@link ApplicationMode#MIRROR mirror} mode.
 */
@MirrorApplicationMode
@Configuration
@ComponentScan(
        basePackages = "com.atlassian.stash.internal.web",
        useDefaultFilters = false, //we only care about these four controllers
        includeFilters = {
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = SetupController.class),
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = MirrorController.class),
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ErrorPageController.class),
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = AboutController.class),
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = XsrfNotificationController.class)
        }
)
public class MirrorMvcConfiguration {
}
