// Path: easyfxml/src/main/java/moe/tristan/easyfxml/api/FxmlStylesheet.java
// public interface FxmlStylesheet {
// 
//     /**
//      * @return the CSS file that composes the stylesheet as a {@link Path}. See {@link
//      * Resources#getResourcePath(String)}
//      */
//     Path getPath();
// 
//     /**
//      * This method is a sample implementation that should work in almost all general cases.
//      * <p>
//      * An {@link java.io.IOException} can be thrown in very rare cases.
//      * <p>
//      * If you encounter them, post an issue with system details.
//      *
//      * @return the CSS file in external form (i.e. with the file:/, http:/...) protocol info before it.
//      *
//      * @see Resources#getResourceURL(String)
//      * @see URL#toExternalForm()
//      */
//     default String getExternalForm() {
//         return Try.of(this::getPath)
//                   .map(Path::toUri)
//                   .mapTry(URI::toURL)
//                   .map(URL::toExternalForm)
//                   .get();
//     }
// 
// }


import java.util.concurrent.CompletionStage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import moe.tristan.easyfxml.api.FxmlStylesheet;
import io.vavr.Tuple;
     */
    public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) {
        LOG.info(
            "Setting stylesheet {} for stage {}({})",
            stylesheet,
            stage.toString(),
            stage.getTitle()
        );
        return FxAsync.doOnFxThread(
            stage,
            theStage -> {
                final Scene stageScene = theStage.getScene();
                stageScene.getStylesheets().clear();
                stageScene.getStylesheets().add(stylesheet);
            }
        );
    }

    public static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final String stylesheet) {
        return stageCreationResult.whenCompleteAsync((res, err) -> setStylesheet(res, stylesheet));
    }

    /**
     * See {@link #setStylesheet(Stage, String)}
     *
     * @param stage      The stage to apply the style to
     * @param stylesheet The {@link FxmlStylesheet} pointing to the stylesheet to apply
     *
     * @return A {@link CompletionStage} to have monitoring over the state of the asynchronous operation
     */
// Path: easyfxml/src/main/java/moe/tristan/easyfxml/api/FxmlStylesheet.java
// public interface FxmlStylesheet {
// 
//     /**
//      * @return the CSS file that composes the stylesheet as a {@link Path}. See {@link
//      * Resources#getResourcePath(String)}
//      */
//     Path getPath();
// 
//     /**
//      * This method is a sample implementation that should work in almost all general cases.
//      * <p>
//      * An {@link java.io.IOException} can be thrown in very rare cases.
//      * <p>
//      * If you encounter them, post an issue with system details.
//      *
//      * @return the CSS file in external form (i.e. with the file:/, http:/...) protocol info before it.
//      *
//      * @see Resources#getResourceURL(String)
//      * @see URL#toExternalForm()
//      */
//     default String getExternalForm() {
//         return Try.of(this::getPath)
//                   .map(Path::toUri)
//                   .mapTry(URI::toURL)
//                   .map(URL::toExternalForm)
//                   .get();
//     }
// 
// }


// Path: easyfxml/src/main/java/moe/tristan/easyfxml/util/Stages.java
import java.util.concurrent.CompletionStage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import moe.tristan.easyfxml.api.FxmlStylesheet;
import io.vavr.Tuple;

     */
    public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) {
        LOG.info(
            "Setting stylesheet {} for stage {}({})",
            stylesheet,
            stage.toString(),
            stage.getTitle()
        );
        return FxAsync.doOnFxThread(
            stage,
            theStage -> {
                final Scene stageScene = theStage.getScene();
                stageScene.getStylesheets().clear();
                stageScene.getStylesheets().add(stylesheet);
            }
        );
    }

    public static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final String stylesheet) {
        return stageCreationResult.whenCompleteAsync((res, err) -> setStylesheet(res, stylesheet));
    }

    /**
     * See {@link #setStylesheet(Stage, String)}
     *
     * @param stage      The stage to apply the style to
     * @param stylesheet The {@link FxmlStylesheet} pointing to the stylesheet to apply
     *
     * @return A {@link CompletionStage} to have monitoring over the state of the asynchronous operation
     */
    public static CompletionStage<Stage> setStylesheet(final Stage stage, final FxmlStylesheet stylesheet) {