package com.github.ferstl.depgraph.graph;

import java.util.Map;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.introspector.BeanAccess;
import com.google.common.collect.ImmutableMap;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class StyleConfiguration {

  NodeConfiguration defaultNodeConfiguration = new NodeConfiguration();
  EdgeConfiguration defaultEdgeConfiguration = new EdgeConfiguration();
  Map<String, NodeConfiguration> scopeNodeConfiguration = ImmutableMap.of("compile", new NodeConfiguration(), "test", new NodeConfiguration());
  Map<NodeResolution, EdgeConfiguration> edgeTypeConfiguration = ImmutableMap.of(NodeResolution.INCLUDED, new EdgeConfiguration(), NodeResolution.OMITTED_FOR_DUPLICATE, new EdgeConfiguration());


  public static void main(String[] args) {
    createGson();
    // createYaml();
  }

  private static void createGson() {
    Gson gson = new GsonBuilder()
        .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
        .setPrettyPrinting()
        .create();

    // NodeConfiguration[] c = new NodeConfiguration[]{new NodeConfiguration(), new NodeConfiguration(), new
    // NodeConfiguration()};
    // System.out.println(gson.toJson(c));
    System.out.println(gson.toJson(new StyleConfiguration()));
  }

  private static void createYaml() {
    DumperOptions options = new DumperOptions();

    Yaml yaml = new Yaml(options);
    yaml.setBeanAccess(BeanAccess.FIELD);
    System.out.println(yaml.dumpAsMap(new StyleConfiguration()));
  }


  static class NodeConfiguration {

    String shape = "polygon";
    int sides = 4;
    String color = "red";
    Font font = new Font();
  }

  static class EdgeConfiguration {

    String style = "dotted";
    String color = "black";
    Font font = new Font();
  }

  static class Font {

    String color = "black";
    int size = 14;
    String name = "Helvetica";
  }
}

@@ -69,277 +69,46 @@
 ort 
-org.yaml.snakeyaml.DumperOptions;%0Aimport org.yaml.snakeyaml.Yaml;%0Aimport org.yaml.snakeyaml.introspector.BeanAccess;%0Aimport com.google.common.collect.ImmutableMap;%0Aimport com.google.gson.FieldNamingPolicy;%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.GsonBuilder
+com.google.common.collect.ImmutableMap
 ;%0A%0Ap
@@ -172,29 +172,16 @@
 aultNode
-Configuration
  = new N
@@ -231,29 +231,16 @@
 aultEdge
-Configuration
  = new E
@@ -297,33 +297,22 @@
 n%3E scope
+d
 Node
-Configuration
+s
  = Immut
@@ -441,29 +441,17 @@
 edgeType
-Configuration
+s
  = Immut
@@ -581,772 +581,8 @@
 ;%0A%0A%0A
-  public static void main(String%5B%5D args) %7B%0A    createGson();%0A    // createYaml();%0A  %7D%0A%0A  private static void createGson() %7B%0A    Gson gson = new GsonBuilder()%0A        .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)%0A        .setPrettyPrinting()%0A        .create();%0A%0A    // NodeConfiguration%5B%5D c = new NodeConfiguration%5B%5D%7Bnew NodeConfiguration(), new NodeConfiguration(), new%0A    // NodeConfiguration()%7D;%0A    // System.out.println(gson.toJson(c));%0A    System.out.println(gson.toJson(new StyleConfiguration()));%0A  %7D%0A%0A  private static void createYaml() %7B%0A    DumperOptions options = new DumperOptions();%0A%0A    Yaml yaml = new Yaml(options);%0A    yaml.setBeanAccess(BeanAccess.FIELD);%0A    System.out.println(yaml.dumpAsMap(new StyleConfiguration()));%0A  %7D%0A%0A%0A
   st

Simplify naming