package p.studio.workspaces.editor;

import javafx.scene.Node;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.SVGPath;

public final class EditorWorkspaceIcons {
    private static final String FOLDER_PATH = "M1.5 4.5A1.5 1.5 0 0 1 3 3h3.2l1.1 1.4H13A1.5 1.5 0 0 1 14.5 5.9V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12z";
    private static final String FILE_PATH = "M4 1.5h5l3 3V13A1.5 1.5 0 0 1 10.5 14.5h-6A1.5 1.5 0 0 1 3 13V3A1.5 1.5 0 0 1 4.5 1.5zm4.7 1.2V5h2.3z";
    private static final String COG_PATH = "M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.24-.68-2.64.72-1.96 1.96l.17.31c.446.816.023 1.84-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1c.895.265 1.318 1.289.872 2.105l-.17.31c-.68 1.24.72 2.64 1.96 1.96l.31-.17a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.24.68 2.64-.72 1.96-1.96l-.17-.31a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.68-1.24-.72-2.64-1.96-1.96l-.31.17a1.464 1.464 0 0 1-2.105-.872z";

    private EditorWorkspaceIcons() {
    }

    public static Node folderDefault() {
        return icon(FOLDER_PATH, "editor-workspace-icon-folder-default");
    }

    public static Node folderSource() {
        return icon(FOLDER_PATH, "editor-workspace-icon-folder-source");
    }

    public static Node folderBuild() {
        return icon(FOLDER_PATH, "editor-workspace-icon-folder-build");
    }

    public static Node file() {
        return icon(FILE_PATH, "editor-workspace-icon-file");
    }

    public static Node cog() {
        return icon(COG_PATH, "editor-workspace-icon-cog");
    }

    private static Node icon(final String path, final String toneClass) {
        final var shape = new SVGPath();
        shape.setContent(path);
        shape.getStyleClass().addAll("editor-workspace-icon-shape", toneClass);

        final var icon = new StackPane(shape);
        icon.getStyleClass().add("editor-workspace-icon");
        return icon;
    }
}
