// Path: domain/src/main/java/uk/co/szmg/grafana/domain/Colors.java
// @JsonSerialize(using = Colors.ColorsSerialiser.class)
// public class Colors {
// 
//     private String low;
//     private String mid;
//     private String high;
// 
//     /**
//      * Default constructor with default colors: red, yellow, green.
//      */
//     public Colors() {
//         this("rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)");
//     }
// 
//     /**
//      * Convenience constructor.
//      * @param low color used when the value is low
//      * @param mid color used when the value is medium
//      * @param high color used when the value is high
//      */
//     public Colors(String low, String mid, String high) {
//         this.low = low;
//         this.mid = mid;
//         this.high = high;
//     }
// 
//     /**
//      * Gets color used when the value is low.
//      * @return color
//      */
//     public String getLow() {
//         return low;
//     }
// 
//     /**
//      * Sets color used when the value is low.
//      * @param low color that's meaningful in HTML
//      */
//     public void setLow(String low) {
//         this.low = low;
//     }
// 
//     /**
//      * Gets color used when the value is medium.
//      * @return color
//      */
//     public String getMid() {
//         return mid;
//     }
// 
//     /**
//      * Sets color used when the value is medium.
//      * @param mid color that's meaningful in HTML
//      */
//     public void setMid(String mid) {
//         this.mid = mid;
//     }
// 
//     /**
//      * Gets color used when the value is high.
//      * @return color
//      */
//     public String getHigh() {
//         return high;
//     }
// 
//     /**
//      * Sets color used when the value is high.
//      * @param high color that's meaningful in HTML
//      */
//     public void setHigh(String high) {
//         this.high = high;
//     }
// 
//     public static class ColorsSerialiser extends JsonSerializer<Colors> {
// 
//         @Override
//         public void serialize(Colors colors, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
//             jsonGenerator.writeStartArray();
//             jsonGenerator.writeString(colors.low);
//             jsonGenerator.writeString(colors.mid);
//             jsonGenerator.writeString(colors.high);
//             jsonGenerator.writeEndArray();
//         }
//     }
// }


import uk.co.szmg.grafana.domain.Colors;
package uk.co.szmg.grafana.dashboard;

/*-
 * #%L
 * grafana-dashboard-generator
 * %%
 * Copyright (C) 2017 Mate Gabor Szvoboda
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */


/**
 * Most dashboards have a common color palette. This class
 * is to store one of that. Extend it in case you'd need
 * more colors in your factories.
 *
 * There are 4 types of color:
 * <dl>
 *     <dt>neutral</dt>
 *     <dd>color for texts that are neither good nor bad; e.g., white</dd>
 *     <dt>healthy</dt>
 *     <dd>color to mark healthy things, e.g., green</dd>
 *     <dt>warning</dt>
 *     <dd>color used for the middle part of the thresholds, e.g., yellow</dd>
 *     <dt>error</dt>
 *     <dd>color that marks an error, e.g., red</dd>
 * </dl>
 *
 * Colors should be defined as html/css color strings.
 *
 * @see BasicFactories
 * @since 1.1
 */
public class ColorTheme {

    /**
     * A simple, red-yellow-green and white theme.
     */
    public static final ColorTheme RED_YELLOW_GREEN = new ColorTheme(
            "white",
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)");

    private String neutral;
    private String healthy;
    private String warning;
    private String error;

    /**
     * Constructor.
     *
     * @param neutral neutral color for texts that are neither good nor bad; e.g., white
     * @param healthy color to mark healthy things, e.g., green
     * @param warning color used for the middle part of the thresholds, e.g., yellow
     * @param error color that marks an error, e.g., red
     */
    public ColorTheme(String neutral, String healthy, String warning, String error) {
        this.neutral = neutral;
        this.healthy = healthy;
        this.warning = warning;
        this.error = error;
    }

    /**
     * Gets neutral color.
     * @return neutral color
     */
    public String getNeutral() {
        return neutral;
    }

    /**
     * Gets healthy color.
     * @return healthy color
     */
    public String getHealthy() {
        return healthy;
    }

    /**
     * Gets warning color.
     * @return warning color
     */
    public String getWarning() {
        return warning;
    }

    /**
     * Gets error color.
     * @return error color
     */
    public String getError() {
        return error;
    }

    /**
     * Gets a color configuration used in singlestat for when low value is good,
     * e.g., number of errors.
     * @return color configuration for singlestat
     */
// Path: domain/src/main/java/uk/co/szmg/grafana/domain/Colors.java
// @JsonSerialize(using = Colors.ColorsSerialiser.class)
// public class Colors {
// 
//     private String low;
//     private String mid;
//     private String high;
// 
//     /**
//      * Default constructor with default colors: red, yellow, green.
//      */
//     public Colors() {
//         this("rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)");
//     }
// 
//     /**
//      * Convenience constructor.
//      * @param low color used when the value is low
//      * @param mid color used when the value is medium
//      * @param high color used when the value is high
//      */
//     public Colors(String low, String mid, String high) {
//         this.low = low;
//         this.mid = mid;
//         this.high = high;
//     }
// 
//     /**
//      * Gets color used when the value is low.
//      * @return color
//      */
//     public String getLow() {
//         return low;
//     }
// 
//     /**
//      * Sets color used when the value is low.
//      * @param low color that's meaningful in HTML
//      */
//     public void setLow(String low) {
//         this.low = low;
//     }
// 
//     /**
//      * Gets color used when the value is medium.
//      * @return color
//      */
//     public String getMid() {
//         return mid;
//     }
// 
//     /**
//      * Sets color used when the value is medium.
//      * @param mid color that's meaningful in HTML
//      */
//     public void setMid(String mid) {
//         this.mid = mid;
//     }
// 
//     /**
//      * Gets color used when the value is high.
//      * @return color
//      */
//     public String getHigh() {
//         return high;
//     }
// 
//     /**
//      * Sets color used when the value is high.
//      * @param high color that's meaningful in HTML
//      */
//     public void setHigh(String high) {
//         this.high = high;
//     }
// 
//     public static class ColorsSerialiser extends JsonSerializer<Colors> {
// 
//         @Override
//         public void serialize(Colors colors, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
//             jsonGenerator.writeStartArray();
//             jsonGenerator.writeString(colors.low);
//             jsonGenerator.writeString(colors.mid);
//             jsonGenerator.writeString(colors.high);
//             jsonGenerator.writeEndArray();
//         }
//     }
// }


// Path: grafana-dashboard-generator/src/main/java/uk/co/szmg/grafana/dashboard/ColorTheme.java
import uk.co.szmg.grafana.domain.Colors;

package uk.co.szmg.grafana.dashboard;

/*-
 * #%L
 * grafana-dashboard-generator
 * %%
 * Copyright (C) 2017 Mate Gabor Szvoboda
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */


/**
 * Most dashboards have a common color palette. This class
 * is to store one of that. Extend it in case you'd need
 * more colors in your factories.
 *
 * There are 4 types of color:
 * <dl>
 *     <dt>neutral</dt>
 *     <dd>color for texts that are neither good nor bad; e.g., white</dd>
 *     <dt>healthy</dt>
 *     <dd>color to mark healthy things, e.g., green</dd>
 *     <dt>warning</dt>
 *     <dd>color used for the middle part of the thresholds, e.g., yellow</dd>
 *     <dt>error</dt>
 *     <dd>color that marks an error, e.g., red</dd>
 * </dl>
 *
 * Colors should be defined as html/css color strings.
 *
 * @see BasicFactories
 * @since 1.1
 */
public class ColorTheme {

    /**
     * A simple, red-yellow-green and white theme.
     */
    public static final ColorTheme RED_YELLOW_GREEN = new ColorTheme(
            "white",
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)");

    private String neutral;
    private String healthy;
    private String warning;
    private String error;

    /**
     * Constructor.
     *
     * @param neutral neutral color for texts that are neither good nor bad; e.g., white
     * @param healthy color to mark healthy things, e.g., green
     * @param warning color used for the middle part of the thresholds, e.g., yellow
     * @param error color that marks an error, e.g., red
     */
    public ColorTheme(String neutral, String healthy, String warning, String error) {
        this.neutral = neutral;
        this.healthy = healthy;
        this.warning = warning;
        this.error = error;
    }

    /**
     * Gets neutral color.
     * @return neutral color
     */
    public String getNeutral() {
        return neutral;
    }

    /**
     * Gets healthy color.
     * @return healthy color
     */
    public String getHealthy() {
        return healthy;
    }

    /**
     * Gets warning color.
     * @return warning color
     */
    public String getWarning() {
        return warning;
    }

    /**
     * Gets error color.
     * @return error color
     */
    public String getError() {
        return error;
    }

    /**
     * Gets a color configuration used in singlestat for when low value is good,
     * e.g., number of errors.
     * @return color configuration for singlestat
     */
    public Colors colorsWhenLowIsHealthy() {