package de.ivu.elect.business.gebietsbaum.entity;

import java.io.Serializable;

public class SvgPath implements Serializable {

  public static final String BLACK = "black";

  private static final String DEFAULT_FILLCOLOR = BLACK;

  private static final String DEFAULT_STROKE_COLOR = "black";

  private static final long DEFAULT_STROKE_WIDTH = 1;

  private static final double DEFAULT_FILL_OPACITY = 1.0d;

  private static final double DEFAULT_STROKE_OPACITY = 1.0d;

  public final String NO_STROKE = "none";

  public final String NO_FILL = "none";

  private final String id;

  private final SvgPathElement svgPathElement;

  public SvgPath(String id, SvgPathElement svgPathElement) {
    this.id = id;
    this.svgPathElement = svgPathElement;
  }

  public String getId() {
    return id;
  }

  private String fillColor = DEFAULT_FILLCOLOR;

  private String strokeColor = DEFAULT_STROKE_COLOR;

  private long strokeWidth = DEFAULT_STROKE_WIDTH;

  private double fillOpacity = DEFAULT_FILL_OPACITY;

  private double strokeOpacity = DEFAULT_STROKE_OPACITY;

  private SvgStrokeLinecap strokeLineCap = SvgStrokeLinecap.ROUND;

  private SvgStrokeLinejoin strokeLinejoin = SvgStrokeLinejoin.ROUND;

  public String getFillColor() {
    return fillColor;
  }

  public void setFillColor(String fillColor) {
    this.fillColor = fillColor;
  }

  public double getFillOpacity() {
    return fillOpacity;
  }

  public void setFillOpacity(double fillOpacity) {
    this.fillOpacity = fillOpacity;
  }

  public String getStrokeColor() {
    return strokeColor;
  }

  public void setStrokeColor(String strokeColor) {
    this.strokeColor = strokeColor;
  }

  public String getStrokeLineCap() {
    return strokeLineCap.name().toLowerCase();
  }

  public void setStrokeLineCap(SvgStrokeLinecap strokeLineCap) {
    this.strokeLineCap = strokeLineCap;
  }

  public String getStrokeLinejoin() {
    return strokeLinejoin.name().toLowerCase();
  }

  public void setStrokeLinejoin(SvgStrokeLinejoin strokeLinejoin) {
    this.strokeLinejoin = strokeLinejoin;
  }

  public double getStrokeOpacity() {
    return strokeOpacity;
  }

  public void setStrokeOpacity(double strokeOpacity) {
    this.strokeOpacity = strokeOpacity;
  }

  public long getStrokeWidth() {
    return strokeWidth;
  }

  public void setStrokeWidth(long strokeWidth) {
    this.strokeWidth = strokeWidth;
  }

  public String getPath() {
    if (svgPathElement==null){
      return "";
    }
    return svgPathElement.getSvgPath();
  }

  public SvgPathElement getSvgPathElement() {
    return svgPathElement;
  }
}
