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

import java.io.Serializable;

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

@Embeddable
public class SelectiveGroupPK implements Serializable {

    private static final long serialVersionUID = -6741844373808204701L;

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

    @Column(name = "subject_code", nullable = false, length = 32)
    private String subjectCode;

    @Column(name = "main_number", nullable = false)
    private Integer mainNumber;

    public Integer getExamId() {
        return examId;
    }

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

    public String getSubjectCode() {
        return subjectCode;
    }

    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }

    public Integer getMainNumber() {
        return mainNumber;
    }

    public void setMainNumber(Integer mainNumber) {
        this.mainNumber = mainNumber;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((examId == null) ? 0 : examId.hashCode());
        result = PRIME * result + ((subjectCode == null) ? 0 : subjectCode.hashCode());
        result = PRIME * result + ((mainNumber == null) ? 0 : mainNumber.hashCode());
        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 SelectiveGroupPK other = (SelectiveGroupPK) obj;
        if (examId == null) {
            if (other.examId != null)
                return false;
        } else if (!examId.equals(other.examId))
            return false;
        if (subjectCode == null) {
            if (other.subjectCode != null)
                return false;
        } else if (!subjectCode.equals(other.subjectCode))
            return false;

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

        return true;
    }

}
