/*
 *   This file is a part of the SteamWar software.
 *
 *   Copyright (C) 2025 SteamWar.de-Serverteam
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package de.steamwar.bausystem.configplayer;

import de.steamwar.bausystem.features.hotbar.DefaultHotbar;
import lombok.experimental.UtilityClass;
import yapion.hierarchy.types.YAPIONObject;

@UtilityClass
public class ConfigCreator {

    public static final int currentVersion = 1;

    public YAPIONObject createDefaultConfig() {
        YAPIONObject yapionObject = new YAPIONObject();
        // This call should never be touched
        yapionObject.add("@version", currentVersion);

        // Any initialising goes into here
        yapionObject.add("baugui", defaultBauGui());

        // Default Hotbar Gui
        yapionObject.add("hotbar", DefaultHotbar.defaultHotbar());
        return yapionObject;
    }

    private YAPIONObject defaultBauGui() {
        YAPIONObject yapionObject = new YAPIONObject();

        //  0:  ? |  1:  ? |  2: 10 |  3:  3 |  4:  7 |  5: 17 |  6: 15 |  7:  ? |  8:  ?
        //  9:  5 | 10:  ? | 11:  ? | 12:  ? | 13:  ? | 14:  ? | 15:  ? | 16:  ? | 17: 16
        // 18:  4 | 19:  ? | 20: 19 | 21: 21 | 22:  9 | 23:  0 | 24:  1 | 25:  ? | 26: 11
        // 27:  6 | 28:  ? | 29:  ? | 30:  ? | 31:  ? | 32:  ? | 33:  ? | 34:  ? | 35: 18
        // 36:  ? | 37: 23 | 38: 20 | 39:  8 | 40: 22 | 41: 26 | 42: 12 | 43: 14 | 44:  ?

        yapionObject.add("10", 2).add("3", 3).add("7", 4).add("17", 5).add("15", 6);
        yapionObject.add("5", 9).add("4", 18).add("6", 27);
        yapionObject.add("16", 17).add("11", 26).add("18", 35);
        yapionObject.add("19", 20).add("21", 21).add("9", 22).add("0", 23).add("1", 24);
        yapionObject.add("23", 37).add("20", 38).add("8", 39).add("22", 40).add("26", 41).add("12", 42).add("14", 43);
        yapionObject.add("size", 45);
        return yapionObject;
    }
}
