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

import java.util.HashSet;
import java.util.Set;

import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;

import cn.com.qmth.stmms.biz.common.BaseQuery;
import cn.com.qmth.stmms.biz.exam.model.Exam;
import cn.com.qmth.stmms.common.enums.ExamStatus;

public class ExamSearchQuery extends BaseQuery<Exam> {

    private String name;

    private Integer creatorId;

    private Integer schoolId;

    private Set<ExamStatus> statusSet;

    private Set<Integer> ids;

    public void orderByIdDesc() {
        setSort(new Sort(Direction.DESC, "id"));
    }

    public Integer getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Integer creatorId) {
        this.creatorId = creatorId;
    }

    public String getName() {
        return name;
    }

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

    public Set<ExamStatus> getStatusSet() {
        return statusSet;
    }

    public void addStatus(ExamStatus status) {
        if (statusSet == null) {
            statusSet = new HashSet<ExamStatus>();
        }
        if (status != null) {
            statusSet.add(status);
        }
    }

    public Set<Integer> getIds() {
        return ids;
    }

    public void addId(Integer id) {
        if (ids == null) {
            ids = new HashSet<Integer>();
        }
        if (id != null) {
            ids.add(id);
        }
    }

    public Integer getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Integer schoolId) {
        this.schoolId = schoolId;
    }

}
