package model;

import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.stage.Screen;

import java.awt.*;

public class SOMLayout {
    // Fonts
    public static final Font H_0 = new Font(Font.SANS_SERIF, 1, 150);
    public static final Font H_1 = new Font(Font.SANS_SERIF, 1, 100);
    public static final Font H_2 = new Font(Font.SANS_SERIF, 1, 75);
    public static final Font P = new Font(Font.SANS_SERIF, 1, 50);
    // Icons & Images
    //UI
    public static final javafx.scene.image.Image GALLERY_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Gallery.png").toString());
    public static final javafx.scene.image.Image SINGLE_PHOTO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_CaptureSingle.png").toString());
    public static final javafx.scene.image.Image SERIES_PHOTO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_CaptureSeries.png").toString());
    public static final javafx.scene.image.Image PRINT_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Print.png").toString());
    public static final javafx.scene.image.Image PICTURE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Picture.png").toString());
    public static final javafx.scene.image.Image SMILE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Smiley.png").toString()); //TODO LINK right image
    public static final javafx.scene.image.Image BACK_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Back.png").toString()); //TODO LINK right image
    public static final javafx.scene.image.Image FORTH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Forth.png").toString()); //TODO LINK right image
    //CI
    public static final javafx.scene.image.Image LOGO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMLogo.png").toString());
    //    public static final javafx.scene.image.Image SPLASH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMSplash.jpg").toString());
    public static final javafx.scene.paint.Color WHITE = new javafx.scene.paint.Color(1, 1, 1, 1);
    public static final Background WHITE_BG = new Background(new BackgroundFill(WHITE, null, null));
    // Screen
//    private static final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    private static final javafx.geometry.Rectangle2D gd = Screen.getPrimary().getBounds();
    public static final int screenWidth = (int) gd.getWidth();
    public static final int screenHeight = (int) gd.getHeight();
    // Layout
    private static final int row = screenHeight / 3;
    private static final int column = screenWidth / 4;
    // Colors
    private static final javafx.scene.paint.Color BLACK = new javafx.scene.paint.Color(0, 0, 0, 1);
    //Backgrounds
    public static final Background BLACK_BG = new Background(new BackgroundFill(BLACK, null, null));
    private static final javafx.scene.paint.Color TRANSPARENT_10 = new javafx.scene.paint.Color(0.05, 0.05, 0.05, 0.6);
    public static final Background TRANSPARENT_10_BG = new Background(new BackgroundFill(TRANSPARENT_10, null, null));
    private static final javafx.scene.paint.Color TRANSPARENT_20 = new javafx.scene.paint.Color(0.05, 0.05, 0.05, 0.8);
    public static final Background TRANSPARENT_20_BG = new Background(new BackgroundFill(TRANSPARENT_20, null, null));
    private static final Background TRANSPARENT_10_BG_ROUNDED = new Background(new BackgroundFill(TRANSPARENT_10, new CornerRadii(12), null));
    private static final Background TRANSPARENT_20_BG_ROUNDED = new Background(new BackgroundFill(TRANSPARENT_20, new CornerRadii(12), null));

    public static int getRow(int span) {
        return row * span;
    }

    public static int getColumn(int span) {
        return column * span;
    }

    public static Background getTransparentBG10rounded(int radius) {
        return new Background(
                new BackgroundFill(
                        TRANSPARENT_10_BG_ROUNDED.getFills().get(0).getFill(),
                        new CornerRadii(radius),
                        TRANSPARENT_10_BG_ROUNDED.getFills().get(0).getInsets()
                )
        );
    }

    public static Background getTransparentBG20rounded(int radius) {
        return new Background(
                new BackgroundFill(
                        TRANSPARENT_20_BG_ROUNDED.getFills().get(0).getFill(),
                        new CornerRadii(radius),
                        TRANSPARENT_20_BG_ROUNDED.getFills().get(0).getInsets()
                )
        );
    }
}