/*
 * 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;

import org.spongepowered.api.plugin.PluginContainer;

import java.util.Map;

/**
 * Represents a possible platform or implementation a {@link Game} could be
 * running on.
 */
public interface Platform {

    String API_ID = "spongeapi";

    /**
     * Retrieves the current {@link Type} this platform is running on.
     *
     * @return The current type
     */
    Type getType();

    /**
     * Retrieves the current {@link Type} the platform is executing on.
     *
     * <p>A Minecraft instance will have a client and server thread. If the
     * server is executing, this will return {@linkplain Type#SERVER} but
     * {@link Platform#getType()} would return {@linkplain Type#CLIENT}.</p>
     *
     * @return The execution type
     */
    Type getExecutionType();

    /**
     * Returns the current API plugin container.
     *
     * @return The API plugin container
     */
    PluginContainer getApi();

    /**
     * Returns the current implementation plugin container.
     *
     * @return The implementation plugin container
     */
    PluginContainer getImplementation();

    /**
     * Gets the current Minecraft version of this platform.
     *
     * @return The Minecraft version
     */
    MinecraftVersion getMinecraftVersion();

    /**
     * Returns this platform instance, as a key-value map.
     *
     * <p>The returned map instance is connected directly to this platform
     * instance. Existing keys like name and version are not modifiable, but
     * new keys are stored in this instance and are shared between any
     * references to a map obtained through the retrieved map.</p>
     *
     * <p>This mechanism allows for platform-specific information like Forge
     * version.</p>
     *
     * @return This platform as a map
     */
    Map<String, Object> asMap();

    /**
     * The type of the platform, or where the game is currently running.
     *
     * <p>A side is what part of Minecraft this is being run on. The client, or
     * the server. The internal server is also treated like a dedicated server.
     * </p>
     */
    enum Type {

        /**
         * The platform of a Minecraft CLIENT is expected.
         */
        CLIENT,

        /**
         * The platform of a Minecraft SERVER is expected.
         */
        SERVER,

        /**
         * It is unknown what platform the game is running on.
         */
        UNKNOWN;

        /**
         * Checks for whether the platform is {@link #SERVER}.
         *
         * @return True if the platform is {@link #SERVER}, false otherwise
         */
        public boolean isServer() {
            return this == SERVER;
        }

        /**
         * Checks for whether the platform is {@link #CLIENT}.
         *
         * @return True if the platform is {@link #CLIENT}, false otherwise
         */
        public boolean isClient() {
            return this == CLIENT;
        }

        /**
         * Checks for whether the platform is known.
         *
         * @return False if the platform is {@link #UNKNOWN}, true otherwise
         */
        public boolean isKnown() {
            return this != UNKNOWN;
        }

    }

}

@@ -2086,298 +2086,934 @@
 the 
-current API plugin container.%0A     *%0A     * @return The API plugin container%0A     */%0A    PluginContainer getApi();%0A%0A    /**%0A     * Returns the current implementation plugin container.%0A     *%0A     * @return The implementation plugin container%0A     */%0A    PluginContainer getImplementation();
+%7B@link PluginContainer%7D for the specified platform%0A     * %7B@link Component%7D.%0A     *%0A     * @param component The platform component%0A     * @return The plugin container for the component%0A     */%0A    PluginContainer getContainer(Component component);%0A%0A    /**%0A     * Returns the current API plugin container.%0A     *%0A     * @return The API plugin container%0A     * @deprecated Use %7B@link #getContainer(Component)%7D with%0A     *     %7B@link Component#API%7D%0A     */%0A    @Deprecated%0A    default PluginContainer getApi() %7B%0A        return getContainer(Component.API);%0A    %7D%0A%0A    /**%0A     * Returns the current implementation plugin container.%0A     *%0A     * @return The implementation plugin container%0A     * @deprecated Use %7B@link #getContainer(Component)%7D with%0A     *     %7B@link Component#IMPLEMENTATION%7D%0A     */%0A    @Deprecated%0A    default PluginContainer getImplementation() %7B%0A        return getContainer(Component.IMPLEMENTATION);%0A    %7D
 %0A%0A  
@@ -5086,10 +5086,402 @@
 %0A    %7D%0A%0A
+    /**%0A     * Represents a part of the %7B@link Platform%7D.%0A     */%0A    enum Component %7B%0A%0A        /**%0A         * The platform the %7B@link #IMPLEMENTATION%7D is based on.%0A         */%0A        GAME,%0A%0A        /**%0A         * The abstraction layer for plugins.%0A         */%0A        API,%0A%0A        /**%0A         * The implementation of the %7B@link #API%7D component.%0A         */%0A        IMPLEMENTATION%0A%0A    %7D%0A%0A
 %7D%0A

Add Minecraft container to Platform interface