/*
 * This file is part of SpongeAPI, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.api.config;

import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.loader.ConfigurationLoader;
import org.spongepowered.configurate.serialize.TypeSerializerCollection;

import java.nio.file.Path;

/**
 * A configuration root is a representation of where configuration
 * data can be stored, which is ultimately mapped to a directory on disk.
 *
 * <p>The underlying directory may refer to a shared directory (shared
 * by many plugins) or one that is specific to a plugin. Be mindful
 * of simply storing data in {@link #getDirectory()} depending on the
 * type of configuration root.</p>
 *
 * <p>A default configuration file is provided via both
 * {@link #getConfigPath()} and {@link #getConfig()}, but other or additional
 * configuration files can be stored in the directory returned by
 * {@link #getDirectory()} (as long as it's
 * not the shared configuration folder).</p>
 *
 * @see ConfigManager A provider of configuration root
 */
public interface ConfigRoot {

    /**
     * Gets the pathname to the default configuration file for the plugin.
     *
     * <p>If the configuration root is shared, then the returned pathname will
     * refer to the path {@code $config/$plugin_id.conf} (where "$config" is the
     * shared configuration directory). Otherwise, the returned pathname will
     * refer to a file named "config.conf" stored in a directory specific to
     * the plugin.</p>
     *
     * <p>The returned pathname may refer to a file that does not yet exist.
     * It is up to the caller of this method to create the file if desired.</p>
     *
     * @return A file, which may not yet exist
     * @see DefaultConfig
     */
    Path getConfigPath();

    /**
     * Gets the configuration file that utilizes the default configuration
     * pathname.
     *
     * @return A configuration object
     * @see #getConfigPath()
     */
    ConfigurationLoader<CommentedConfigurationNode> getConfig();

    /**
     * Get the serializers applicable to this root.
     *
     * <p>The returned serializers will be for Sponge and Adventure types, as
     * well as an object mapper that can use any applicable
     * Guice {@link com.google.inject.Injector} to create instances.</p>
     *
     * @return applicable serializers
     * @see ConfigManager#getSerializers() for globally available serializers
     */
    TypeSerializerCollection getSerializers();

    /**
     * Gets the directory that this configuration root refers to.
     *
     * <p>The returned pathname may not refer to a directory that exists
     * yet.</p>
     *
     * @return A directory
     */
    Path getDirectory();
}

@@ -1389,15 +1389,8 @@
 ate.
-loader.
 Conf
@@ -1398,22 +1398,23 @@
 guration
-Loader
+Options
 ;%0Aimport
@@ -1448,42 +1448,34 @@
 ate.
-serialize.TypeSerializ
+load
 er
+.
 Co
-llection
+nfigurationLoader
 ;%0A%0Ai
@@ -3084,32 +3084,504 @@
 athname.%0A     *%0A
+     * %3Cp%3EThe returned loader will default to using options that:%3C/p%3E%0A     * %3Cul%3E%0A     *     %3Cli%3ECopy default values to the configuration%3C/li%3E%0A     *     %3Cli%3EImplicitly initialize values (so will provide an empty value if%0A     *     no default is provided)%3C/li%3E%0A     *     %3Cli%3EUse the Sponge default %7B@link org.spongepowered.configurate.serialize.TypeSerializer TypeSerializers%7D,%0A     *     as described in %7B@link ConfigManager#getSerializers()%7D.%3C/li%3E%0A     * %3C/ul%3E%0A     *%0A
      * @return A
@@ -3727,48 +3727,88 @@
  Get
+s
  the 
-seria
+configuration file that uti
 lize
-r
 s 
-applicable to this root
+the default configuration%0A     * pathname
 .%0A  
@@ -3839,240 +3839,169 @@
 ned 
-serializ
+load
 er
-s
  will 
-be for Sponge and Adventure types, as%0A     * well as an object mapper that can use any applicable%0A     * Guice %7B@link com.google.inject.Injector%7D to create instances.%3C/p%3E%0A     *%0A     * @return applicable serializers
+default to using the provided options.%3C/p%3E%0A     *%0A     * @param options Default options to be used when loading%0A     * @return A configuration object
 %0A   
@@ -4013,126 +4013,129 @@
 see 
+#get
 Config
-Manager#getSerializers() for globally available serializers%0A     */%0A    TypeSerializ
+Path()%0A     */%0A    ConfigurationLoad
 er
+%3C
 Co
-llection getSerializers(
+mmentedConfigurationNode%3E getConfig(final ConfigurationOptions options
 );%0A%0A

Update ConfigRoot to accomodate Guice changes