package com.axis.innovators.box.register;

import com.axis.innovators.box.Main;
import com.axis.innovators.box.gui.MainWindow;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

/**
 * 负责注册Registration项（限定时机，在执行.run之前可设置）
 * @author tzdwindows 7
 */
public class RegistrationTool {
    private static final Logger logger = LogManager.getLogger(RegistrationTool.class);
    private final List<MainWindow.ToolCategory> toolCategories = new ArrayList<>();
    private final Main main;

    public RegistrationTool(Main mainWindow){
        this.main = mainWindow;
    }

    /**
     * 注册ToolCategory
     * @param toolCategory ToolCategory
     */
    void addToolCategory(MainWindow.ToolCategory toolCategory){
        if (!main.isWindow()) {
            toolCategories.add(toolCategory);
        } else {
            logger.warn("Wrong time to add tools");
        }
    }

    public List<MainWindow.ToolCategory> getToolCategories() {
        return toolCategories;
    }
}
