package cn.com.qmth.stmms.biz.mark.model;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import cn.com.qmth.stmms.biz.exam.model.Marker;

/**
 * 标准评卷结果对象
 * 
 * @author luoshi
 *
 */
public class MarkResult {

    /**
     * 评卷状态
     */
    private int statusValue;

    /**
     * 考生编号
     */
    private Integer studentId;

    /**
     * 评卷任务编号
     */
    private Integer libraryId;

    /**
     * 总分
     */
    private double totalScore;

    /**
     * 分值列表
     */
    private String scoreList;

    /**
     * 阅卷轨迹列表
     */
    private TrackDTO[] trackList;

    /**
     * 特殊标记列表
     */
    private SpecialTagDTO[] tagList;

    /**
     * 所花时间
     */
    private int spent;

    public int getStatusValue() {
        return statusValue;
    }

    public void setStatusValue(int statusValue) {
        this.statusValue = statusValue;
    }

    public Integer getLibraryId() {
        return libraryId;
    }

    public void setLibraryId(Integer libraryId) {
        this.libraryId = libraryId;
    }

    public double getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(double totalScore) {
        this.totalScore = totalScore;
    }

    public String getScoreList() {
        return scoreList;
    }

    public void setScoreList(String scoreList) {
        this.scoreList = scoreList;
    }

    public TrackDTO[] getTrackList() {
        return trackList;
    }

    public void setTrackList(TrackDTO[] trackList) {
        this.trackList = trackList;
    }

    public SpecialTagDTO[] getTagList() {
        return tagList;
    }

    public void setTagList(SpecialTagDTO[] tagList) {
        this.tagList = tagList;
    }

    public int getSpent() {
        return spent;
    }

    public void setSpent(int spent) {
        this.spent = spent;
    }

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public Map<String, List<TrackDTO>> getTrackMap() {
        Map<String, List<TrackDTO>> map = new HashMap<String, List<TrackDTO>>();
        if (trackList != null) {
            for (TrackDTO dto : trackList) {
                String questionNumber = dto.getQuestionNumber();
                List<TrackDTO> list = map.get(questionNumber);
                if (list == null) {
                    list = new LinkedList<TrackDTO>();
                    map.put(questionNumber, list);
                }
                list.add(dto);
            }
        }
        return map;
    }

    public Map<String, List<MarkTrack>> getTrackMap(MarkLibrary library, Marker marker) {
        Map<String, List<MarkTrack>> map = new HashMap<>();
        if (trackList != null) {
            for (TrackDTO dto : trackList) {
                String questionNumber = dto.getQuestionNumber();
                List<MarkTrack> list = map.get(questionNumber);
                if (list == null) {
                    list = new LinkedList<MarkTrack>();
                    map.put(questionNumber, list);
                }
                list.add(dto.transform(library, marker));
            }
        }
        return map;
    }

    public List<MarkTrack> getTrackList(MarkLibrary library, Marker marker) {
        List<MarkTrack> list = new LinkedList<>();
        if (trackList != null) {
            for (TrackDTO dto : trackList) {
                list.add(dto.transform(library, marker));
            }
        }
        return list;
    }

    public List<TrialTrack> getTrackList(TrialHistory history) {
        List<TrialTrack> list = new LinkedList<>();
        if (trackList != null) {
            for (TrackDTO dto : trackList) {
                list.add(dto.transform(history));
            }
        }
        return list;
    }

    public List<MarkSpecialTag> getSpecialTagList(MarkLibrary library, Marker marker) {
        List<MarkSpecialTag> list = new LinkedList<>();
        if (tagList != null) {
            for (SpecialTagDTO dto : tagList) {
                list.add(dto.transform(library));
            }
        }
        return list;
    }

    public List<TrialTag> getTagList(TrialHistory history) {
        List<TrialTag> list = new LinkedList<>();
        if (tagList != null) {
            for (SpecialTagDTO dto : tagList) {
                list.add(dto.transform(history));
            }
        }
        return list;
    }

}
