// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
// 
//     T setLayout(Layout layout);
//     Layout getLayout();
// 
//     void convertFor(GuiElement element, Point point);
// 
//     /**
//      * Converts the global coordinates of the point to ones relative to the element.
//      * @param element The element, must be part of this container
//      * @param point The point
//      * @param relativeLayer Layer at which the point is relative to this element,
//      *                      positive values are above this element
//      */
//     void convertFor(GuiElement element, Point point, int relativeLayer);
// 
//     Map<GuiElement, LayoutData> getElements();
//     T addElements(LayoutData layoutData, GuiElement... elements);
//     T removeElement(GuiElement element);
//     T sortElements();
//     T sortElements(Comparator<GuiElement> comparator);
// 
//     ReadableColor getBackgroundColor();
//     T setBackgroundColor(ReadableColor backgroundColor);
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
// 
//     MinecraftClient getMinecraft();
// 
//     GuiContainer getContainer();
//     T setContainer(GuiContainer container);
// 
//     void layout(ReadableDimension size, RenderInfo renderInfo);
//     void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
// 
//     ReadableDimension getMinSize();
//     ReadableDimension getMaxSize();
// 
//     T setMaxSize(ReadableDimension maxSize);
// 
//     boolean isEnabled();
//     T setEnabled(boolean enabled);
//     T setEnabled();
//     T setDisabled();
// 
//     GuiElement getTooltip(RenderInfo renderInfo);
//     T setTooltip(GuiElement tooltip);
// 
//     /**
//      * Returns the layer this element takes part in.
//      * The standard layer is layer 0. Event handlers will be called for this layer.
//      * @return The layer of this element
//      */
//     int getLayer();
// 
// }


import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
 * This file is part of jGui API, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 johni0702 <https://github.com/johni0702>
 * 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 de.johni0702.minecraft.gui.layout;



public class VerticalLayout implements Layout {
    private static final Data DEFAULT_DATA = new Data(0);

    private final Alignment alignment;

    private int spacing;

    public VerticalLayout() {
        this(Alignment.TOP);
    }

    public VerticalLayout(Alignment alignment) {
        this.alignment = alignment;
    }

    @Override
// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
// 
//     T setLayout(Layout layout);
//     Layout getLayout();
// 
//     void convertFor(GuiElement element, Point point);
// 
//     /**
//      * Converts the global coordinates of the point to ones relative to the element.
//      * @param element The element, must be part of this container
//      * @param point The point
//      * @param relativeLayer Layer at which the point is relative to this element,
//      *                      positive values are above this element
//      */
//     void convertFor(GuiElement element, Point point, int relativeLayer);
// 
//     Map<GuiElement, LayoutData> getElements();
//     T addElements(LayoutData layoutData, GuiElement... elements);
//     T removeElement(GuiElement element);
//     T sortElements();
//     T sortElements(Comparator<GuiElement> comparator);
// 
//     ReadableColor getBackgroundColor();
//     T setBackgroundColor(ReadableColor backgroundColor);
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
// 
//     MinecraftClient getMinecraft();
// 
//     GuiContainer getContainer();
//     T setContainer(GuiContainer container);
// 
//     void layout(ReadableDimension size, RenderInfo renderInfo);
//     void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
// 
//     ReadableDimension getMinSize();
//     ReadableDimension getMaxSize();
// 
//     T setMaxSize(ReadableDimension maxSize);
// 
//     boolean isEnabled();
//     T setEnabled(boolean enabled);
//     T setEnabled();
//     T setDisabled();
// 
//     GuiElement getTooltip(RenderInfo renderInfo);
//     T setTooltip(GuiElement tooltip);
// 
//     /**
//      * Returns the layer this element takes part in.
//      * The standard layer is layer 0. Event handlers will be called for this layer.
//      * @return The layer of this element
//      */
//     int getLayer();
// 
// }


// Path: src/main/java/de/johni0702/minecraft/gui/layout/VerticalLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;

/*
 * This file is part of jGui API, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 johni0702 <https://github.com/johni0702>
 * 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 de.johni0702.minecraft.gui.layout;



public class VerticalLayout implements Layout {
    private static final Data DEFAULT_DATA = new Data(0);

    private final Alignment alignment;

    private int spacing;

    public VerticalLayout() {
        this(Alignment.TOP);
    }

    public VerticalLayout(Alignment alignment) {
        this.alignment = alignment;
    }

    @Override
    public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) {