/*
 * *************************************************
 * Copyright (c) 2018 QMTH. All Rights Reserved.
 * Created by Deason on 2018-07-12 15:31:10.
 * *************************************************
 */

package cn.com.qmth.examcloud.core.questions.base.converter.model.dps;

import cn.com.qmth.examcloud.core.questions.base.converter.model.platform.PaperDetailVo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 试卷的大题项
 */
public class PaperDetailDto implements Serializable {
    private static final long serialVersionUID = 2180336388838138300L;
    private Integer number;//序号
    private String name;//题型名称
    private Double totalScore;//总分
    private Integer questionCount;//题数量
    private List<QuestionDto> questions;//试题列表

    public PaperDetailDto(PaperDetailVo detail) {
        this.number = detail.getNumber();
        this.name = detail.getName();
        this.totalScore = detail.getTotalScore();
        this.questionCount = detail.getQuestionCount();
    }

    public PaperDetailDto(String name) {
        this.name = name;
    }

    public PaperDetailDto() {

    }

    public void addQuestion(QuestionDto question) {
        if (questions == null) {
            questions = new ArrayList<>();
        }
        questions.add(question);
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getTotalScore() {
        return totalScore;
    }

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

    public Integer getQuestionCount() {
        //return questionCount;
        return getQuestions().size();
    }

    public void setQuestionCount(Integer questionCount) {
        this.questionCount = questionCount;
    }

    public List<QuestionDto> getQuestions() {
        if (questions == null) {
            return new ArrayList<>();
        }
        return questions;
    }

    public void setQuestions(List<QuestionDto> questions) {
        this.questions = questions;
    }

}