// 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;
    @Nullable
    @Override
    protected String[] getImports() {
        boolean version4 = PropertiesComponent.getInstance().getBoolean(Constant.OKHTTP_VERSION, true);
        if (version4) {
            return new String[]{"okhttp3.MultipartBody",
                    "okhttp3.RequestBody",
                    "okhttp3.MediaType",
                    "okhttp3.MediaType.Companion.toMediaTypeOrNull",
                    "okhttp3.RequestBody.Companion.asRequestBody"};
        }
        return new String[]{"okhttp3.MultipartBody",
                "okhttp3.RequestBody",
                "okhttp3.MediaType"};
    }

    @Override
    protected void buildMethodBody(KtClass ktClass, KtClassBody body, KtLightClass lightClass, PsiField[] fields, boolean needAll, StringBuilder sb) {
        if (needAll) {
            sb.append(mFieldName).append(".setType(MultipartBody.FORM)\n");
        }
        for (PsiField field : fields) {
            PsiElement older = null;
            if (field instanceof KtLightField) {
                older = ((KtLightField) field).getKotlinOrigin();
            }
            if (!findIgnore(older == null ? field : older)) {
                String defaultKey;
                if ((defaultKey = getPostFileKey(older == null ? field : older)) != null) {
                    boolean nullable = isNullable(field);
// 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/KotlinParamsFileBodyBuilder.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;

    @Nullable
    @Override
    protected String[] getImports() {
        boolean version4 = PropertiesComponent.getInstance().getBoolean(Constant.OKHTTP_VERSION, true);
        if (version4) {
            return new String[]{"okhttp3.MultipartBody",
                    "okhttp3.RequestBody",
                    "okhttp3.MediaType",
                    "okhttp3.MediaType.Companion.toMediaTypeOrNull",
                    "okhttp3.RequestBody.Companion.asRequestBody"};
        }
        return new String[]{"okhttp3.MultipartBody",
                "okhttp3.RequestBody",
                "okhttp3.MediaType"};
    }

    @Override
    protected void buildMethodBody(KtClass ktClass, KtClassBody body, KtLightClass lightClass, PsiField[] fields, boolean needAll, StringBuilder sb) {
        if (needAll) {
            sb.append(mFieldName).append(".setType(MultipartBody.FORM)\n");
        }
        for (PsiField field : fields) {
            PsiElement older = null;
            if (field instanceof KtLightField) {
                older = ((KtLightField) field).getKotlinOrigin();
            }
            if (!findIgnore(older == null ? field : older)) {
                String defaultKey;
                if ((defaultKey = getPostFileKey(older == null ? field : older)) != null) {
                    boolean nullable = isNullable(field);
                    FileInfo fileInfo = getFileInfo(field, nullable ? FileInfo.KOTLIN_CHILD : field.getName(), false);