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

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class ExamNumberPK implements Serializable {

    private static final long serialVersionUID = -4806329348030887113L;

    @Column(name = "exam_id", nullable = false)
    private Integer examId;

    @Column(name = "exam_number", nullable = false, length = 128)
    private String examNumber;

    @Column(name = "is_objective", nullable = false, columnDefinition = "tinyint(1)")
    private boolean objective;

    public Integer getExamId() {
        return examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public String getExamNumber() {
        return examNumber;
    }

    public void setExamNumber(String examNumber) {
        this.examNumber = examNumber;
    }

    public boolean isObjective() {
        return objective;
    }

    public void setObjective(boolean objective) {
        this.objective = objective;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((examId == null) ? 0 : examId.hashCode());
        result = PRIME * result + ((examNumber == null) ? 0 : examNumber.hashCode());
        result = PRIME * result + (objective ? 1 : 0);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final ExamNumberPK other = (ExamNumberPK) obj;
        if (examId == null) {
            if (other.examId != null)
                return false;
        } else if (!examId.equals(other.examId))
            return false;

        if (examNumber == null) {
            if (other.examNumber != null)
                return false;
        } else if (!examNumber.equals(other.examNumber))
            return false;

        if (objective != other.objective) {
            return false;
        }

        return true;
    }

}
