package com.gingersoft.gsa.cloud.ui.AAChartCore.AAChartCoreLib.AATools;

import java.util.HashMap;
import java.util.Map;

public class AAGradientColor {

    public static HashMap<String, Object> oceanBlueColor() {
        return oceanBlueColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> sanguineColor() {
        return sanguineColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> lusciousLimeColor() {
        return lusciousLimeColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> purpleLakeColor() {
        return purpleLakeColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> freshPapayaColor() {
        return freshPapayaColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> ultramarineColor() {
        return ultramarineColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> pinkSugarColor() {
        return pinkSugarColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> lemonDrizzleColor() {
        return lemonDrizzleColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> victoriaPurpleColor() {
        return victoriaPurpleColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> springGreensColor() {
        return springGreensColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> mysticMauveColor() {
        return mysticMauveColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> reflexSilverColor() {
        return reflexSilverColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> neonGlowColor() {
        return neonGlowColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> berrySmoothieColor() {
        return berrySmoothieColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> newLeafColor() {
        return newLeafColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> cottonCandyColor() {
        return cottonCandyColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> pixieDustColor() {
        return pixieDustColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> fizzyPeachColor() {
        return fizzyPeachColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> sweetDreamColor() {
        return sweetDreamColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> firebrickColor() {
        return firebrickColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> wroughtIronColor() {
        return wroughtIronColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> deepSeaColor() {
        return deepSeaColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> coastalBreezeColor() {
        return coastalBreezeColor(AALinearGradientDirection.ToTop);
    }

    public static HashMap<String, Object> eveningDelightColor() {
        return eveningDelightColor(AALinearGradientDirection.ToTop);
    }


    public static HashMap<String, Object> oceanBlueColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#2E3192","#1BFFFF");
    }

    public static HashMap<String, Object> sanguineColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#D4145A","#FBB03B");
    }

    public static HashMap<String, Object> lusciousLimeColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#009245","#FCEE21");
    }

    public static HashMap<String, Object> purpleLakeColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#662D8C","#ED1E79");
    }

    public static HashMap<String, Object> freshPapayaColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#ED1C24","#FCEE21");
    }

    public static HashMap<String, Object> ultramarineColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#00A8C5","#FFFF7E");
    }

    public static HashMap<String, Object> pinkSugarColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#D74177","#FFE98A");
    }

    public static HashMap<String, Object> lemonDrizzleColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#FB872B","#D9E021");
    }

    public static HashMap<String, Object> victoriaPurpleColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#312A6C","#852D91");
    }

    public static HashMap<String, Object> springGreensColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#009E00","#FFFF96");
    }

    public static HashMap<String, Object> mysticMauveColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#B066FE","#63E2FF");
    }

    public static HashMap<String, Object> reflexSilverColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#808080","#E6E6E6");
    }

    public static HashMap<String, Object> neonGlowColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#00FFA1","#00FFFF");
    }

    public static HashMap<String, Object> berrySmoothieColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#8E78FF","#FC7D7B");
    }

    public static HashMap<String, Object> newLeafColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#00537E","#3AA17E");
    }

    public static HashMap<String, Object> cottonCandyColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#FCA5F1","#B5FFFF");
    }

    public static HashMap<String, Object> pixieDustColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#D585FF","#00FFEE");
    }

    public static HashMap<String, Object> fizzyPeachColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#F24645","#EBC08D");
    }

    public static HashMap<String, Object> sweetDreamColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#3A3897","#A3A1FF");
    }

    public static HashMap<String, Object> firebrickColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#45145A","#FF5300");
    }

    public static HashMap<String, Object> wroughtIronColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#333333","#5A5454");
    }

    public static HashMap<String, Object> deepSeaColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#4F00BC","#29ABE2");
    }

    public static HashMap<String, Object> coastalBreezeColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#00B7FF","#FFFFC7");
    }

    public static HashMap<String, Object> eveningDelightColor(AALinearGradientDirection direction) {
        return linearGradient(direction,"#93278F","#00A99D");
    }

    public static HashMap<String, Object> linearGradient(String startColor,
                                                         String endColor) {
      return linearGradient(AALinearGradientDirection.ToTop, startColor, endColor);
    }

    public static HashMap<String, Object> linearGradient(
            AALinearGradientDirection direction,
            String startColor,
            String endColor
    ) {
        Object[][] stopsArr =  new Object[][]{
                {0  ,startColor},
                {1  ,endColor},
        };

        return linearGradient(direction,stopsArr);
    }

    public static HashMap<String, Object> linearGradient(
            AALinearGradientDirection direction,
            Object[][] stopsArr
    ) {
        Map linearGradientMap = linearGradientMap(direction);
        HashMap linearGradientColorMap = new HashMap<String, Object>();
        linearGradientColorMap.put("linearGradient",linearGradientMap);
        linearGradientColorMap.put("stops",stopsArr);
        return linearGradientColorMap;
    }

    /**
     (0,0) ----------- (1,0)
     |                   |
     |                   |
     |                   |
     |                   |
     |                   |
     (0,1) ----------- (1,1)
     */
    private static Map linearGradientMap(AALinearGradientDirection direction) {
        switch (direction)    {
            case ToTop:
                return linearGradientMap(0, 1, 0, 0);
            case ToBottom:
                return linearGradientMap(0, 0, 0, 1);
            case ToLeft:
                return linearGradientMap(1, 0, 0, 0);
            case ToRight:
                return linearGradientMap(0, 0, 1, 0);
            case ToTopLeft:
                return linearGradientMap(1, 1, 0, 0);
            case ToTopRight:
                return linearGradientMap(0, 1, 1, 0);
            case ToBottomLeft:
                return linearGradientMap(1, 0, 0, 1);
            case ToBottomRight:
                return linearGradientMap(0, 0, 1, 1);
               default: return null;
        }
    }

    private static Map linearGradientMap(int x1, int y1, int x2, int y2) {
        Map linearGradientMap = new HashMap<String, Integer>();
        linearGradientMap.put("x1",x1);
        linearGradientMap.put("y1",y1);
        linearGradientMap.put("x2",x2);
        linearGradientMap.put("y2",y2);
        return linearGradientMap;
    }
}
