package carelender.view;

import javafx.geometry.VPos;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * This class contains static methods to help to render the calendar view
 */
public class RenderHelper {
    /**
     * Draws a calendar square with a drop shadow
     * @param gc
     * @param x
     * @param y
     * @param w
     * @param h
     * @param dropOffset
     * @param color
     * @param text
     * @param dailyEventNumbers 
     */
    public static void calendarSquare ( GraphicsContext gc,  double x, double y, double w, double h, double dropOffset, String color, String text, Font font, int[] dailyEventNumbers ) {
        gc.setFill(Color.web("#999"));
        gc.fillRect(x + dropOffset, y + dropOffset, w, h);

        gc.setFill(Color.web(color));
        gc.fillRect(x, y, w, h);

        gc.setFill(Color.web("4ecdc4"));
        gc.setTextAlign(TextAlignment.RIGHT);
        gc.setFont(font);
        gc.setTextBaseline(VPos.BOTTOM);
        gc.fillText(text, x + w - dropOffset * 0.5 , y + h - dropOffset * 0.5 );
        
        for (int i=0; i<dailyEventNumbers.length; i++) {
        	int numArc = dailyEventNumbers[i];
        	if (numArc > 3) {
        		numArc = 3;
        	}
        	for (int j=0; j<numArc; j++) {
        		System.out.println("I tried with i " + i + " j " + j);
        		gc.setFill(Color.web("4ecdc4"));
        		gc.arc(x + w*((double) j + 1)/40.0, y + h*((double) i + 1)/40.0, w/40, h/40, 0, 0);
        	}
        }
    }


}

@@ -1207,16 +1207,75 @@
        %0A
+        double x_offset;%0A        double y_offset;%0A        %0A
         
@@ -1367,16 +1367,26 @@
 ers%5Bi%5D;%0A
+        %09%0A
         
@@ -1481,73 +1481,8 @@
 ) %7B%0A
-        %09%09System.out.println(%22I tried with i %22 + i + %22 j %22 + j);%0A
     
@@ -1534,16 +1534,42 @@
   %09%09
-gc.arc(x
+x_offset = x + w*((double) j)/10.0
  + w
@@ -1588,17 +1588,62 @@
  + 1
+.0
 )/
-40.0, y
+20.0;%0A        %09%09y_offset = y + h*((double) i)/10.0
  + h
@@ -1662,31 +1662,73 @@
  + 1
+.0
 )/
-4
+2
 0.0
+;%0A        %09%09gc.fillRect(x_offset, y_offset
 , w/
-4
+10.
 0, h/
-40, 0, 
+10.
 0);%0A

make the draw function of calendar square work