// Path: autopath-compiler/src/main/java/architect/autopath/compiler/spec/ConstructorSpec.java
// public class ConstructorSpec {
// 
//     private final List<ParamSpec> fields;
// 
//     public ConstructorSpec() {
//         fields = new LinkedList<>();
//     }
// 
//     public List<ParamSpec> getFields() {
//         return fields;
//     }
// 
//     public boolean isDefault() {
//         return fields.isEmpty();
//     }
// }


import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ArrayTypeName;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.lang.model.element.Modifier;
import architect.autopath.compiler.spec.ConstructorSpec;
import architect.autopath.compiler.spec.ParamSpec;
import architect.autopath.compiler.spec.PathSpec;
import processorworkflow.AbstractComposer;
package architect.autopath.compiler.composer;





/**
 * @author Lukasz Piliszczuk - lukasz.pili@gmail.com
 */
public class PathComposer extends AbstractComposer<PathSpec> {

    private static final ClassName NAVIGATIONPATH_CLS = ClassName.get("architect", "StackPath");
    private static final ClassName PARCEL_CLS = ClassName.get("android.os", "Parcel");
    private static final ClassName PARCEL_CREATOR_CLS = ClassName.get("android.os.Parcelable", "Creator");
    private static final ClassName CONTEXT_CLS = ClassName.get("android.content", "Context");

    public PathComposer(List<architect.autopath.compiler.spec.PathSpec> specs) {
        super(specs);
    }

    @Override
    protected JavaFile compose(PathSpec spec) {
        TypeSpec typeSpec = build(spec);
        return JavaFile.builder(spec.getClassName().packageName(), typeSpec).build();
    }

    private TypeSpec build(PathSpec spec) {
        StringBuilder constructorParamsStringBuilder = new StringBuilder();
        List<FieldSpec> fieldSpecs = new ArrayList<>();
        for (ParamSpec paramSpec : spec.getFields()) {
            fieldSpecs.add(FieldSpec.builder(paramSpec.getTypeName(), paramSpec.getName()).build());
            constructorParamsStringBuilder.append(paramSpec.getName()).append(", ");
        }
        if (constructorParamsStringBuilder.length() > 0) {
            constructorParamsStringBuilder.delete(constructorParamsStringBuilder.length() - 2, constructorParamsStringBuilder.length());
        }
        String constructorParamsString = constructorParamsStringBuilder.toString();

        List<MethodSpec> methodSpecs = new ArrayList<>();
// Path: autopath-compiler/src/main/java/architect/autopath/compiler/spec/ConstructorSpec.java
// public class ConstructorSpec {
// 
//     private final List<ParamSpec> fields;
// 
//     public ConstructorSpec() {
//         fields = new LinkedList<>();
//     }
// 
//     public List<ParamSpec> getFields() {
//         return fields;
//     }
// 
//     public boolean isDefault() {
//         return fields.isEmpty();
//     }
// }


// Path: autopath-compiler/src/main/java/architect/autopath/compiler/composer/PathComposer.java
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ArrayTypeName;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.lang.model.element.Modifier;
import architect.autopath.compiler.spec.ConstructorSpec;
import architect.autopath.compiler.spec.ParamSpec;
import architect.autopath.compiler.spec.PathSpec;
import processorworkflow.AbstractComposer;

package architect.autopath.compiler.composer;





/**
 * @author Lukasz Piliszczuk - lukasz.pili@gmail.com
 */
public class PathComposer extends AbstractComposer<PathSpec> {

    private static final ClassName NAVIGATIONPATH_CLS = ClassName.get("architect", "StackPath");
    private static final ClassName PARCEL_CLS = ClassName.get("android.os", "Parcel");
    private static final ClassName PARCEL_CREATOR_CLS = ClassName.get("android.os.Parcelable", "Creator");
    private static final ClassName CONTEXT_CLS = ClassName.get("android.content", "Context");

    public PathComposer(List<architect.autopath.compiler.spec.PathSpec> specs) {
        super(specs);
    }

    @Override
    protected JavaFile compose(PathSpec spec) {
        TypeSpec typeSpec = build(spec);
        return JavaFile.builder(spec.getClassName().packageName(), typeSpec).build();
    }

    private TypeSpec build(PathSpec spec) {
        StringBuilder constructorParamsStringBuilder = new StringBuilder();
        List<FieldSpec> fieldSpecs = new ArrayList<>();
        for (ParamSpec paramSpec : spec.getFields()) {
            fieldSpecs.add(FieldSpec.builder(paramSpec.getTypeName(), paramSpec.getName()).build());
            constructorParamsStringBuilder.append(paramSpec.getName()).append(", ");
        }
        if (constructorParamsStringBuilder.length() > 0) {
            constructorParamsStringBuilder.delete(constructorParamsStringBuilder.length() - 2, constructorParamsStringBuilder.length());
        }
        String constructorParamsString = constructorParamsStringBuilder.toString();

        List<MethodSpec> methodSpecs = new ArrayList<>();
        for (ConstructorSpec constructorSpec : spec.getConstructors()) {