package sbu.javafx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {

        FXMLLoader loader = new FXMLLoader(getClass().getResource("/sbu/javafx/App-view.fxml"));
        Parent root = loader.load();

        MusicController controller = loader.getController();

        controller.musicsListView.getItems().addAll(
                new Song("Blinding Lights", "The Weeknd","/musics/The-Weeknd-Blinding-Lights-128.mp3"),
                new Song("Comme des enfants", "Coert De Pirate","/musics/Coeur-De-Pirate-Comme-des-enfants-128.mp3"),
                new Song("Slow Down", "GRAE", "/musics/GRAE-Slow-Down-128.mp3"),
                new Song("Cigarettes out the Window", "TV Girl", "/musics/TV-Girl-Cigarettes-out-the-Window-128.mp3"),
                new Song("deja vu", "Olivia Rodirgo", "/musics/Olivia-Rodrigo-deja-vu-320.mp3"),
                new Song("The Line", "Twoenty One Pilots", "/musics/Twenty-One-Pilots-The-Line-128.mp3"),
                new Song("Bones", "Imagine Dragons", "/musics/Imagine-Dragons-Bones-128.mp3"),
                new Song("Bunker", "Balthazar", "/musics/Balthazar-Bunker-128.mp3"),
                new Song("As It Was", "Harry Styles", "/musics/Harry-Styles-As-It-Was-320.mp3")
        );

        controller.setupListView(controller.musicsListView);
        controller.setupListView(controller.playlistListView);

        Scene scene = new Scene(root, 500, 600);
        scene.getStylesheets().add(
                getClass().getResource("/css/light.css").toExternalForm()
        );

        primaryStage.setTitle("Music Player");
        primaryStage.setScene(scene);
        primaryStage.getIcons().add(
                new Image(getClass().getResourceAsStream("/image/icon.png"))
        );
        primaryStage.setResizable(false);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}