/**
 * 
 */
package de.bstly.board.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Maps;

import de.bstly.board.businesslogic.SettingsManager;

/**
 * The Class SettingsController.
 */
@RestController
@RequestMapping("/settings")
public class SettingsController extends BaseController {

	@Autowired
	private SettingsManager settingsManager;

	/**
	 * Gets the default settings.
	 *
	 * @return the default settings
	 */
	@GetMapping
	public Map<String, Object> getDefaultSettings() {
		Map<String, Object> settings = Maps.newHashMap();
		settings.put("gravity", getGravity());
		settings.put("pageSize", getPageSize());
		settings.put("entryDelay", getEntryDelay());
		settings.put("commentDelay", getCommentDelay());
		settings.put("maxTags", settingsManager.getMaxTags());
		settings.put("maxViews", settingsManager.getMaxViews());
		settings.put("defaultGravity", settingsManager.getGravity());
		settings.put("defaultPageSize", settingsManager.getPageSize());
		settings.put("defaultEntryDelay", settingsManager.getEntryDelay());
		settings.put("defaultCommentDelay", settingsManager.getCommentDelay());
		return settings;
	}

}
