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

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.Transient;

import cn.com.qmth.stmms.common.enums.ScorePolicy;

@Entity
@Table(name = "eb_selective_group")
public class SelectiveGroup implements Serializable {

    private static final long serialVersionUID = 7866856607752769258L;

    @EmbeddedId
    private SelectiveGroupPK pk;

    // 选做题分组
    @Column(name = "selective_index", nullable = false)
    private Integer selectiveIndex;

    // 选做题合分数量
    @Column(name = "selective_count", nullable = false)
    private Integer selectiveCount;

    // 选做题分区
    @Column(name = "selective_part", nullable = false)
    private Integer selectivePart;

    // 选做题合分方式
    @Column(name = "score_policy", nullable = true, length = 16)
    @Enumerated(EnumType.STRING)
    private ScorePolicy scorePolicy;

    @Transient
    private String title;

    @Transient
    private Double partScore;

    public SelectiveGroup() {
        this.pk = new SelectiveGroupPK();
    }

    public SelectiveGroup(Integer examId, String subjectCode, Integer mainNumber, Integer selectiveIndex,
            Integer selectiveCount, Integer selectivePart, ScorePolicy scorePolicy) {
        this.pk = new SelectiveGroupPK();
        this.pk.setExamId(examId);
        this.pk.setSubjectCode(subjectCode);
        this.pk.setMainNumber(mainNumber);
        this.selectiveCount = selectiveCount;
        this.selectiveIndex = selectiveIndex;
        this.selectivePart = selectivePart;
        this.scorePolicy = scorePolicy == null ? ScorePolicy.MAX : scorePolicy;
    }

    public Integer getExamId() {
        return pk.getExamId();
    }

    public void setExamId(Integer examId) {
        pk.setExamId(examId);
    }

    public String getSubjectCode() {
        return pk.getSubjectCode();
    }

    public void setSubjectCode(String subjectCode) {
        pk.setSubjectCode(subjectCode);
    }

    public Integer getMainNumber() {
        return pk.getMainNumber();
    }

    public void setMainNumber(Integer mainNumber) {
        pk.setMainNumber(mainNumber);
    }

    public Integer getSelectiveIndex() {
        return selectiveIndex;
    }

    public void setSelectiveIndex(Integer selectiveIndex) {
        this.selectiveIndex = selectiveIndex;
    }

    public Integer getSelectiveCount() {
        return selectiveCount;
    }

    public void setSelectiveCount(Integer selectiveCount) {
        this.selectiveCount = selectiveCount;
    }

    public ScorePolicy getScorePolicy() {
        return scorePolicy;
    }

    public void setScorePolicy(ScorePolicy scorePolicy) {
        this.scorePolicy = scorePolicy;
    }

    public Integer getSelectivePart() {
        return selectivePart;
    }

    public void setSelectivePart(Integer selectivePart) {
        this.selectivePart = selectivePart;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Double getPartScore() {
        return partScore;
    }

    public void setPartScore(Double partScore) {
        this.partScore = partScore;
    }
}
