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

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

/**
 * 分档档次
 * Created by zhengmin on 2016/9/21.
 */
@Entity
@Table(indexes = {
        @Index(name = "idx_level_workId_code",columnList = "workId,code",unique = true)})
public class Level implements Serializable{


    private static final long serialVersionUID = -5290818783456310642L;

    public int getLevelValue() {
        return levelValue;
    }

    public void setLevelValue(int levelValue) {
        this.levelValue = levelValue;
    }

    public Long getWorkId() {
        return workId;
    }

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

    public Long getId() {
        return id;
    }

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

    public static enum LevelType{
        /**
         * 非录取
         */
        UNADMIT,
        /**
         * 录取
         */
        ADMITED
    }

    @Id
    @GeneratedValue
    private Long id;

    private Long workId;

    @NotNull
    private String code;

    private int levelValue;

    @NotNull
    private Integer maxScore;

    @NotNull
    private Integer minScore;

    /**
     * 给分间隔
     */
    private int intervalScore = 1;

    @NotNull
    private Integer weight;

    @Enumerated(value = EnumType.ORDINAL)
    private LevelType levelType;

    /**
     * 非录取挡位的给分集合
     */
    private String scoreList;

    /**
     * 占比阈值。percent thredhold，0-100
     */
    private int pt = 0;
    /**
     * 考区阀值
     */
    private int kdpt = 0;

    public Level(){}

    public Level(Long workId,String code, int levelValue, int maxScore, int minScore, LevelType levelType,Integer weight) {
        this.workId = workId;
        this.code = code;
        this.levelValue = levelValue;
        this.maxScore = maxScore;
        this.minScore = minScore;
        this.levelType = levelType;
        this.weight = weight;
        this.pt = 100;
        this.kdpt = 100;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getMaxScore() {
        return maxScore;
    }

    public void setMaxScore(Integer maxScore) {
        this.maxScore = maxScore;
    }

    public Integer getMinScore() {
        return minScore;
    }

    public void setMinScore(Integer minScore) {
        this.minScore = minScore;
    }

    public int getIntervalScore() {
        return intervalScore;
    }

    public void setIntervalScore(int intervalScore) {
        this.intervalScore = intervalScore;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public LevelType getLevelType() {
        return levelType;
    }

    public void setLevelType(LevelType levelType) {
        this.levelType = levelType;
    }

    public String getScoreList() {
        return scoreList;
    }

    public void setScoreList(String scoreList) {
        this.scoreList = scoreList;
    }

    public int getPt() {
        return pt;
    }

    public void setPt(int pt) {
        this.pt = pt;
    }

    public int getKdpt() {
        return kdpt;
    }

    public void setKdpt(int kdpt) {
        this.kdpt = kdpt;
    }
}
