package ch.difty.scipamato.publ.web.autoconfiguration;

import org.apache.wicket.protocol.http.WebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

import com.giffing.wicket.spring.boot.context.extensions.ApplicationInitExtension;
import com.giffing.wicket.spring.boot.context.extensions.WicketApplicationInitConfiguration;

import de.agilecoders.wicket.core.Bootstrap;
import de.agilecoders.wicket.core.settings.ThemeProvider;
import de.agilecoders.wicket.less.BootstrapLess;
import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider;

@ApplicationInitExtension
@ConditionalOnProperty(prefix = BootstrapProperties.PROPERTY_PREFIX, value = "enabled", matchIfMissing = true)
@ConditionalOnClass(BootstrapConfig.class)
@EnableConfigurationProperties({ BootstrapProperties.class })
public class BootstrapConfig implements WicketApplicationInitConfiguration {

    private final BootstrapProperties prop;

    public BootstrapConfig(BootstrapProperties prop) {
        this.prop = prop;
    }

    @Override
    public void init(WebApplication webApplication) {
        final ThemeProvider themeProvider = new BootswatchThemeProvider(prop.getTheme());
        prop.setThemeProvider(themeProvider);

        Bootstrap.install(webApplication, prop);

        BootstrapLess.install(webApplication);
    }

}

@@ -607,16 +607,22 @@
 ettings.
+Single
 ThemePro
@@ -729,42 +729,26 @@
 tml.
-bootswatch.BootswatchThemeProvider
+google.GoogleTheme
 ;%0A%0A@
@@ -1279,49 +1279,57 @@
     
-final ThemeProvider themeProvider = new B
+// TODO configurable solution to switch between b
 oots
@@ -1337,39 +1337,39 @@
 atch
-T
+ t
 heme
-Provider(prop.getTheme());
+s and google and own etc.
 %0A   
@@ -1395,17 +1395,27 @@
 rovider(
-t
+new SingleT
 hemeProv
@@ -1418,16 +1418,35 @@
 Provider
+(new GoogleTheme())
 );%0A%0A    

Use SingleThemeProvider - here google