package io.budgetapp.configuration;

import com.bazaarvoice.dropwizard.assets.AssetsBundleConfiguration;
import com.bazaarvoice.dropwizard.assets.AssetsConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.budgetapp.db.CustomDataSourceFactory;
import io.budgetapp.model.Budget;
import io.budgetapp.model.Category;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class AppConfiguration extends Configuration implements AssetsBundleConfiguration {

    @Valid
    @NotNull
    @JsonProperty("database")
    private DataSourceFactory database = new CustomDataSourceFactory();

    @Valid
    @NotNull
    @JsonProperty
    private final AssetsConfiguration assets = new AssetsConfiguration();

    @Valid
    @NotNull
    @JsonProperty("categories")
    private List<Category> categories = new ArrayList<>();

    @Valid
    @NotNull
    @JsonProperty("budgets")
    private Map<String, List<Budget>> budgets = new LinkedHashMap<>();

    public DataSourceFactory getDataSourceFactory() {
        return database;
    }

    @Override
    public AssetsConfiguration getAssetsConfiguration() {
        return assets;
    }

    public List<Category> getCategories() {
        return categories;
    }

    public Map<String, List<Budget>> getBudgets() {
        return budgets;
    }
}
@@ -218,56 +218,8 @@
 ty;%0A
-import io.budgetapp.db.CustomDataSourceFactory;%0A
 impo
@@ -248,16 +248,16 @@
 Budget;%0A
+
 import i
@@ -677,38 +677,8 @@
 ull%0A
-    @JsonProperty(%22database%22)%0A
     
@@ -722,14 +722,8 @@
 new 
-Custom
 Data
@@ -768,26 +768,8 @@
 ull%0A
-    @JsonProperty%0A
     
@@ -867,40 +867,8 @@
 ull%0A
-    @JsonProperty(%22categories%22)%0A
     
@@ -1202,24 +1202,24 @@
 uration() %7B%0A
-
         retu
@@ -1228,32 +1228,503 @@
  assets;%0A    %7D%0A%0A
+    @JsonProperty(%22assets%22)%0A    public AssetsConfiguration getAssets() %7B%0A        return assets;%0A    %7D%0A%0A    @JsonProperty(%22database%22)%0A    public void setDatabase(DataSourceFactory database) %7B%0A        this.database = database;%0A    %7D%0A%0A    @JsonProperty(%22categories%22)%0A    public void setCategories(List%3CCategory%3E categories) %7B%0A        this.categories = categories;%0A    %7D%0A%0A    public void setBudgets(Map%3CString, List%3CBudget%3E%3E budgets) %7B%0A        this.budgets = budgets;%0A    %7D%0A%0A
     public List%3C

change "Expense" to "Expenditure"