package cn.com.qmth.stmms.ms.core.domain.user;

import cn.com.qmth.stmms.ms.core.vo.Subject;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * 评卷员组
 * Created by zhengmin on 2016/9/22.
 */
@Entity
public class MarkerGroup implements Serializable{

    private static final long serialVersionUID = 966105324299193932L;
    @Id
    @GeneratedValue
    private Long id;

    private String name;

    @OneToMany
    @JoinColumn(name = "groupId")
    private Set<MarkUser> markers = new HashSet<>();

    @NotNull
    @Enumerated(value = EnumType.STRING)
    private Subject subject;

    @NotNull
    private Long workId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

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

    public Set<MarkUser> getMarkers() {
        return markers;
    }

    public void setMarkers(Set<MarkUser> markers) {
        this.markers = markers;
    }

    public void addMarker(MarkUser marker){
        this.markers.add(marker);
    }

    public Subject getSubject() {
        return subject;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }
}
