// Path: src/com/wang/okhttpparamsget/Constant.java
// public class Constant {
// 
//     //Map<String, String>
//     public static final int TYPE_MAP_STRING = 1;
//     //Map<String, Object>
//     public static final int TYPE_MAP_OBJECT = 2;
//     //Map<String, RequestBody>
//     public static final int TYPE_MAP_BODY = 3;
//     //List<MultipartBody.Part>
//     public static final int TYPE_LIST_PART = 4;
//     //MultipartBody.Builder
//     public static final int TYPE_BODY_BUILDER = 5;
// 
//     public static final String VALUE_NULL = "okhttpparamsget_value_null";
// 
//     public static final String ARRAY_MAP = "okhttpparamsget_array_map";
// 
//     public static final String ANDROIDX = "okhttpparamsget_android_x";
// 
//     public static final String NULLABLE = "okhttpparamsget_null_able";
// 
//     public static final String OKHTTP_VERSION = "okhttpparamsget_okhttp_version";
// 
//     public static final String NOTIFICATION_GROUP_ID = "com.wang.okhttpparamsget";
// 
// }
// 
// Path: src/com/wang/okhttpparamsget/data/FileInfo.java
// public class FileInfo {
// 
//     public static final int NORMAL = 0;
//     public static final int ARRAY = 1;
//     public static final int LIST = 2;
//     public static final int MAP = 3;
// 
//     public static final String MAP_CHILD = "entry";
//     public static final String LIST_CHILD = "file";
//     public static final String KOTLIN_CHILD = "it";
// 
//     public final int type;
// 
//     public final String className;
// 
//     public String key;
// 
//     public String filename;
// 
//     public String mimeType;
// 
//     public String data;
// 
//     public FileInfo(String className, String key, String filename, String mimeType, String data) {
//         this(NORMAL, className, key, filename, mimeType, data);
//     }
// 
//     public FileInfo(int type, String className, String key, String filename, String mimeType, String data) {
//         this.type = type;
//         this.className = className;
//         this.key = key;
//         this.filename = filename;
//         this.mimeType = mimeType;
//         this.data = data;
//     }
// 
//     public boolean isMap() {
//         return type == MAP;
//     }
// 
//     public boolean isListOrArray() {
//         return type == LIST || type == ARRAY;
//     }
// 
//     public boolean isNorm() {
//         return type == NORMAL;
//     }
// }


import com.intellij.ide.util.PropertiesComponent;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.wang.okhttpparamsget.Constant;
import com.wang.okhttpparamsget.data.FileInfo;
import org.jetbrains.kotlin.asJava.classes.KtLightClass;
import org.jetbrains.kotlin.asJava.elements.KtLightField;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassBody;
import javax.annotation.Nullable;
                        sb.append(field.getName()).append(nullable ? "?." : ".").append("forEach{ (key, value) ->\n");
                    }

                    sb.append(mFieldName).append(".add(").append(getValueType()).append(".createFormData(").append(defaultKey.isEmpty() || fileInfo.isMap() ? fileInfo.key : defaultKey).append(",")
                            .append(fileInfo.filename).append(",");
                    createRequestBody(sb, fileInfo.mimeType, fileInfo.data, true);
                    sb.append("))\n");

                    if (nullable || !fileInfo.isNorm()) {
                        sb.append("}\n");
                    }
                } else if (isNullable(field)) {
                    defaultKey = getParamName(older == null ? field : older);
                    addNullableValue(field, sb, defaultKey);
                } else {
                    defaultKey = getParamName(older == null ? field : older);
                    sb.append(mFieldName).append(".add(").append(getValueType()).append(".createFormData(");
                    if (defaultKey == null) {
                        sb.append('"').append(field.getName()).append('"');
                    } else {
                        sb.append(defaultKey);
                    }
                    sb.append(", ").append(toString(field, false, null)).append("))\n");
                }
            }
        }
    }

    @Override
    protected void addNullableValue(PsiField field, StringBuilder sb, String defaultName) {
// Path: src/com/wang/okhttpparamsget/Constant.java
// public class Constant {
// 
//     //Map<String, String>
//     public static final int TYPE_MAP_STRING = 1;
//     //Map<String, Object>
//     public static final int TYPE_MAP_OBJECT = 2;
//     //Map<String, RequestBody>
//     public static final int TYPE_MAP_BODY = 3;
//     //List<MultipartBody.Part>
//     public static final int TYPE_LIST_PART = 4;
//     //MultipartBody.Builder
//     public static final int TYPE_BODY_BUILDER = 5;
// 
//     public static final String VALUE_NULL = "okhttpparamsget_value_null";
// 
//     public static final String ARRAY_MAP = "okhttpparamsget_array_map";
// 
//     public static final String ANDROIDX = "okhttpparamsget_android_x";
// 
//     public static final String NULLABLE = "okhttpparamsget_null_able";
// 
//     public static final String OKHTTP_VERSION = "okhttpparamsget_okhttp_version";
// 
//     public static final String NOTIFICATION_GROUP_ID = "com.wang.okhttpparamsget";
// 
// }
// 
// Path: src/com/wang/okhttpparamsget/data/FileInfo.java
// public class FileInfo {
// 
//     public static final int NORMAL = 0;
//     public static final int ARRAY = 1;
//     public static final int LIST = 2;
//     public static final int MAP = 3;
// 
//     public static final String MAP_CHILD = "entry";
//     public static final String LIST_CHILD = "file";
//     public static final String KOTLIN_CHILD = "it";
// 
//     public final int type;
// 
//     public final String className;
// 
//     public String key;
// 
//     public String filename;
// 
//     public String mimeType;
// 
//     public String data;
// 
//     public FileInfo(String className, String key, String filename, String mimeType, String data) {
//         this(NORMAL, className, key, filename, mimeType, data);
//     }
// 
//     public FileInfo(int type, String className, String key, String filename, String mimeType, String data) {
//         this.type = type;
//         this.className = className;
//         this.key = key;
//         this.filename = filename;
//         this.mimeType = mimeType;
//         this.data = data;
//     }
// 
//     public boolean isMap() {
//         return type == MAP;
//     }
// 
//     public boolean isListOrArray() {
//         return type == LIST || type == ARRAY;
//     }
// 
//     public boolean isNorm() {
//         return type == NORMAL;
//     }
// }


// Path: src/com/wang/okhttpparamsget/builder/KotlinParamsFilePartBuilder.java
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.wang.okhttpparamsget.Constant;
import com.wang.okhttpparamsget.data.FileInfo;
import org.jetbrains.kotlin.asJava.classes.KtLightClass;
import org.jetbrains.kotlin.asJava.elements.KtLightField;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassBody;
import javax.annotation.Nullable;

                        sb.append(field.getName()).append(nullable ? "?." : ".").append("forEach{ (key, value) ->\n");
                    }

                    sb.append(mFieldName).append(".add(").append(getValueType()).append(".createFormData(").append(defaultKey.isEmpty() || fileInfo.isMap() ? fileInfo.key : defaultKey).append(",")
                            .append(fileInfo.filename).append(",");
                    createRequestBody(sb, fileInfo.mimeType, fileInfo.data, true);
                    sb.append("))\n");

                    if (nullable || !fileInfo.isNorm()) {
                        sb.append("}\n");
                    }
                } else if (isNullable(field)) {
                    defaultKey = getParamName(older == null ? field : older);
                    addNullableValue(field, sb, defaultKey);
                } else {
                    defaultKey = getParamName(older == null ? field : older);
                    sb.append(mFieldName).append(".add(").append(getValueType()).append(".createFormData(");
                    if (defaultKey == null) {
                        sb.append('"').append(field.getName()).append('"');
                    } else {
                        sb.append(defaultKey);
                    }
                    sb.append(", ").append(toString(field, false, null)).append("))\n");
                }
            }
        }
    }

    @Override
    protected void addNullableValue(PsiField field, StringBuilder sb, String defaultName) {
        boolean add = PropertiesComponent.getInstance().getBoolean(Constant.VALUE_NULL, false);