package cn.com.qmth.examcloud.core.questions.dao.entity;

import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
import cn.com.qmth.examcloud.core.questions.dao.entity.base.IdBase;
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyNumberDto;

import java.util.List;

/**
 * Created by songyue on 17/3/21.
 */
public class PaperDetailUnitStruct extends IdBase {

    private Integer number;

    private Double score;//小题分数

    private QuesStructType questionType;//小题类型

    private List<String> quesNames;//来源大题

    private String propertyId; //属性名

    private String difficulty; //难度

    private Boolean publicity; //公开度

    private String propertyGroup; //单个属性组（用来筛选题目）

    public PaperDetailUnitStruct() {

    }

    public PaperDetailUnitStruct(PaperDetailStruct paperDetailStruct, int number, CoursePropertyNumberDto coursePropertyNumberDto) {
        this.setScore(paperDetailStruct.getScore());
        this.setId(String.valueOf(number));
        this.setNumber(number);
        this.setQuestionType(paperDetailStruct.getQuestionType());
        this.setQuesNames(paperDetailStruct.getQuesNames());
        this.setPropertyId(buildPropertyId(coursePropertyNumberDto));
    }

    private String buildPropertyId(CoursePropertyNumberDto coursePropertyNumberDto) {
        //有一级属性和二姐属性
        if (!Property.ROOT_PARENT_ID.equals(coursePropertyNumberDto.getPropertyParentId())) {
            return coursePropertyNumberDto.getPropertyParentId() + "-" + coursePropertyNumberDto.getPropertyId();
        }

        return String.valueOf(coursePropertyNumberDto.getPropertyId());
    }

    public Integer getNumber() {
        return number;
    }

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

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public QuesStructType getQuestionType() {
        return questionType;
    }

    public void setQuestionType(QuesStructType questionType) {
        this.questionType = questionType;
    }

    public List<String> getQuesNames() {
        return quesNames;
    }

    public void setQuesNames(List<String> quesNames) {
        this.quesNames = quesNames;
    }

    public Boolean getPublicity() {
        return publicity;
    }

    public void setPublicity(Boolean publicity) {
        this.publicity = publicity;
    }

    public String getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(String difficulty) {
        this.difficulty = difficulty;
    }

    public String getPropertyId() {
        return propertyId;
    }

    public void setPropertyId(String propertyId) {
        this.propertyId = propertyId;
    }

    public String getPropertyGroup() {
        return propertyGroup;
    }

    public void setPropertyGroup(String propertyGroup) {
        this.propertyGroup = propertyGroup;
    }

}
