// Path: app/src/main/java/io/github/emanual/app/entity/InterviewJSONEntity.java
// public class InterviewJSONEntity extends BaseEntity {
// 
//     private String title;
//     private InterviewInfoEntity info;
// 
//     public InterviewInfoEntity getInfo() {
//         return info;
//     }
// 
//     public void setInfo(InterviewInfoEntity info) {
//         this.info = info;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Override public String toString() {
//         return "InterviewJSONEntity{" +
//                 "info=" + info +
//                 ", title='" + title + '\'' +
//                 '}';
//     }
// }
// 
// Path: app/src/main/java/io/github/emanual/app/entity/QuestionEntity.java
// public class QuestionEntity extends BaseEntity {
//     /**
//      * 回答
//      */
//     private final static String TYPE_REPLY = "reply";
//     /**
//      * 选择
//      */
//     private final static String TYPE_CHOICE = "choice";
//     /**
//      * 判断
//      */
//     private final static String TYPE_JUDGMENT = "judgment";
//     private String type;
//     private String tag;
//     private int difficulty;
//     private String from;
//     private String description;
//     private String answer;
//     private List<String> options;
// 
//     public String getAnswer() {
//         return answer;
//     }
// 
//     public void setAnswer(String answer) {
//         this.answer = answer;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public int getDifficulty() {
//         return difficulty;
//     }
// 
//     public void setDifficulty(int difficulty) {
//         this.difficulty = difficulty;
//     }
// 
//     public String getFrom() {
//         return from;
//     }
// 
//     public void setFrom(String from) {
//         this.from = from;
//     }
// 
//     public List<String> getOptions() {
//         return options;
//     }
// 
//     public void setOptions(List<String> options) {
//         this.options = options;
//     }
// 
//     public String getTag() {
//         return tag;
//     }
// 
//     public void setTag(String tag) {
//         this.tag = tag;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     @Override public String toString() {
//         return "QuestionEntity{" +
//                 "answer='" + answer + '\'' +
//                 ", type='" + type + '\'' +
//                 ", tag='" + tag + '\'' +
//                 ", difficulty=" + difficulty +
//                 ", from='" + from + '\'' +
//                 ", description='" + description + '\'' +
//                 ", options=" + options +
//                 '}';
//     }
// }


import android.content.Context;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import io.github.emanual.app.entity.InterviewJSONEntity;
import io.github.emanual.app.entity.QuestionEntity;
package io.github.emanual.app.utils;




/**
 * Author: jayin
 * Date: 2/25/16
 */
public class InterviewResource {
    /**
     * 获取所有interviews/* 所有文件名(英文名)列表
     * @param context
     * @return
     */
    public static List<String> getInterviewNameList(Context context) {
        List<String> books = new ArrayList<>();
        File bookDir = new File(AppPath.getInterviewsPath(context));
        if (!bookDir.exists()) {
            bookDir.mkdirs();
        }
        books.addAll(Arrays.asList(bookDir.list()));
        return books;
    }

    /**
     * 获取所有interviews/<name>/interview/interview.json
     * @param context
     * @return
     */
    public static List<InterviewJSONEntity> getInterviewJSONList(Context context) {
        List<InterviewJSONEntity> interviewJSONEntities = new ArrayList<>();
        File interviewDir = new File(AppPath.getInterviewsPath(context));
        if (!interviewDir.exists()) {
            interviewDir.mkdirs();
        }
        for (String interviewName : interviewDir.list()) {
            String json = _.readFile(AppPath.getInterviewJSONFilePath(context, interviewName));
            InterviewJSONEntity interviewJSONEntity = InterviewJSONEntity.createByJSON(json, InterviewJSONEntity.class);
            interviewJSONEntities.add(interviewJSONEntity);
        }
        return interviewJSONEntities;
    }

    /**
     * 获取Questions
     * 获取所有interviews/<name>/interview/questions/*.json
     * @param context
     * @param interviewName
     * @return
     */
// Path: app/src/main/java/io/github/emanual/app/entity/InterviewJSONEntity.java
// public class InterviewJSONEntity extends BaseEntity {
// 
//     private String title;
//     private InterviewInfoEntity info;
// 
//     public InterviewInfoEntity getInfo() {
//         return info;
//     }
// 
//     public void setInfo(InterviewInfoEntity info) {
//         this.info = info;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Override public String toString() {
//         return "InterviewJSONEntity{" +
//                 "info=" + info +
//                 ", title='" + title + '\'' +
//                 '}';
//     }
// }
// 
// Path: app/src/main/java/io/github/emanual/app/entity/QuestionEntity.java
// public class QuestionEntity extends BaseEntity {
//     /**
//      * 回答
//      */
//     private final static String TYPE_REPLY = "reply";
//     /**
//      * 选择
//      */
//     private final static String TYPE_CHOICE = "choice";
//     /**
//      * 判断
//      */
//     private final static String TYPE_JUDGMENT = "judgment";
//     private String type;
//     private String tag;
//     private int difficulty;
//     private String from;
//     private String description;
//     private String answer;
//     private List<String> options;
// 
//     public String getAnswer() {
//         return answer;
//     }
// 
//     public void setAnswer(String answer) {
//         this.answer = answer;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public int getDifficulty() {
//         return difficulty;
//     }
// 
//     public void setDifficulty(int difficulty) {
//         this.difficulty = difficulty;
//     }
// 
//     public String getFrom() {
//         return from;
//     }
// 
//     public void setFrom(String from) {
//         this.from = from;
//     }
// 
//     public List<String> getOptions() {
//         return options;
//     }
// 
//     public void setOptions(List<String> options) {
//         this.options = options;
//     }
// 
//     public String getTag() {
//         return tag;
//     }
// 
//     public void setTag(String tag) {
//         this.tag = tag;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     @Override public String toString() {
//         return "QuestionEntity{" +
//                 "answer='" + answer + '\'' +
//                 ", type='" + type + '\'' +
//                 ", tag='" + tag + '\'' +
//                 ", difficulty=" + difficulty +
//                 ", from='" + from + '\'' +
//                 ", description='" + description + '\'' +
//                 ", options=" + options +
//                 '}';
//     }
// }


// Path: app/src/main/java/io/github/emanual/app/utils/InterviewResource.java
import android.content.Context;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import io.github.emanual.app.entity.InterviewJSONEntity;
import io.github.emanual.app.entity.QuestionEntity;

package io.github.emanual.app.utils;




/**
 * Author: jayin
 * Date: 2/25/16
 */
public class InterviewResource {
    /**
     * 获取所有interviews/* 所有文件名(英文名)列表
     * @param context
     * @return
     */
    public static List<String> getInterviewNameList(Context context) {
        List<String> books = new ArrayList<>();
        File bookDir = new File(AppPath.getInterviewsPath(context));
        if (!bookDir.exists()) {
            bookDir.mkdirs();
        }
        books.addAll(Arrays.asList(bookDir.list()));
        return books;
    }

    /**
     * 获取所有interviews/<name>/interview/interview.json
     * @param context
     * @return
     */
    public static List<InterviewJSONEntity> getInterviewJSONList(Context context) {
        List<InterviewJSONEntity> interviewJSONEntities = new ArrayList<>();
        File interviewDir = new File(AppPath.getInterviewsPath(context));
        if (!interviewDir.exists()) {
            interviewDir.mkdirs();
        }
        for (String interviewName : interviewDir.list()) {
            String json = _.readFile(AppPath.getInterviewJSONFilePath(context, interviewName));
            InterviewJSONEntity interviewJSONEntity = InterviewJSONEntity.createByJSON(json, InterviewJSONEntity.class);
            interviewJSONEntities.add(interviewJSONEntity);
        }
        return interviewJSONEntities;
    }

    /**
     * 获取Questions
     * 获取所有interviews/<name>/interview/questions/*.json
     * @param context
     * @param interviewName
     * @return
     */
    public static List<QuestionEntity> getQuestionList(Context context, String interviewName){