// Path: src/main/java/com/squareup/protoparser/Utils.java
// static void appendDocumentation(StringBuilder builder, String documentation) {
//   if (documentation.isEmpty()) {
//     return;
//   }
//   for (String line : documentation.split("\n")) {
//     builder.append("// ").append(line).append('\n');
//   }
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static void appendIndented(StringBuilder builder, String value) {
//   for (String line : value.split("\n")) {
//     builder.append("  ").append(line).append('\n');
//   }
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static <T> T checkNotNull(T value, String name) {
//   if (value == null) {
//     throw new NullPointerException(name + " == null");
//   }
//   return value;
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static <T> List<T> immutableCopyOf(List<T> list) {
//   return unmodifiableList(new ArrayList<>(list));
// }


import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import static com.squareup.protoparser.Utils.appendDocumentation;
import static com.squareup.protoparser.Utils.appendIndented;
import static com.squareup.protoparser.Utils.checkNotNull;
import static com.squareup.protoparser.Utils.immutableCopyOf;
      for (FieldElement field : fields()) {
        appendIndented(builder, field.toSchema());
      }
    }
    if (!oneOfs().isEmpty()) {
      builder.append('\n');
      for (OneOfElement oneOf : oneOfs()) {
        appendIndented(builder, oneOf.toSchema());
      }
    }
    if (!extensions().isEmpty()) {
      builder.append('\n');
      for (ExtensionsElement extension : extensions()) {
        appendIndented(builder, extension.toSchema());
      }
    }
    if (!nestedElements().isEmpty()) {
      builder.append('\n');
      for (TypeElement type : nestedElements()) {
        appendIndented(builder, type.toSchema());
      }
    }
    return builder.append("}\n").toString();
  }

  public static final class Builder {
    private String name;
    private String qualifiedName;
    private String documentation = "";
    private final List<FieldElement> fields = new ArrayList<>();
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static void appendDocumentation(StringBuilder builder, String documentation) {
//   if (documentation.isEmpty()) {
//     return;
//   }
//   for (String line : documentation.split("\n")) {
//     builder.append("// ").append(line).append('\n');
//   }
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static void appendIndented(StringBuilder builder, String value) {
//   for (String line : value.split("\n")) {
//     builder.append("  ").append(line).append('\n');
//   }
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static <T> T checkNotNull(T value, String name) {
//   if (value == null) {
//     throw new NullPointerException(name + " == null");
//   }
//   return value;
// }
// 
// Path: src/main/java/com/squareup/protoparser/Utils.java
// static <T> List<T> immutableCopyOf(List<T> list) {
//   return unmodifiableList(new ArrayList<>(list));
// }


// Path: src/main/java/com/squareup/protoparser/MessageElement.java
import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import static com.squareup.protoparser.Utils.appendDocumentation;
import static com.squareup.protoparser.Utils.appendIndented;
import static com.squareup.protoparser.Utils.checkNotNull;
import static com.squareup.protoparser.Utils.immutableCopyOf;

      for (FieldElement field : fields()) {
        appendIndented(builder, field.toSchema());
      }
    }
    if (!oneOfs().isEmpty()) {
      builder.append('\n');
      for (OneOfElement oneOf : oneOfs()) {
        appendIndented(builder, oneOf.toSchema());
      }
    }
    if (!extensions().isEmpty()) {
      builder.append('\n');
      for (ExtensionsElement extension : extensions()) {
        appendIndented(builder, extension.toSchema());
      }
    }
    if (!nestedElements().isEmpty()) {
      builder.append('\n');
      for (TypeElement type : nestedElements()) {
        appendIndented(builder, type.toSchema());
      }
    }
    return builder.append("}\n").toString();
  }

  public static final class Builder {
    private String name;
    private String qualifiedName;
    private String documentation = "";
    private final List<FieldElement> fields = new ArrayList<>();
    private final List<OneOfElement> oneOfs = new ArrayList<>();