package com.qmth.teachcloud.report.business.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.teachcloud.common.contant.SystemConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * <p>
 * 等级配置表（试卷难易度、成绩在学院排名百分比）
 * </p>
 *
 * @author wangliang
 * @since 2021-06-01
 */
@ApiModel(value = "TBCommonLevelConfig对象", description = "等级配置表（试卷难易度、成绩在学院排名百分比）")
public class TBCommonLevelConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id")
    private Long id;

    @ApiModelProperty(value = "教研分析考试id")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(value = "exam_id")
    private Long examId;

    @ApiModelProperty(value = "科目编码")
    @TableField(value = "course_code")
    private String courseCode;

    @ApiModelProperty(value = "科目名称")
    @TableField(value = "course_name")
    private String courseName;

    @ApiModelProperty(value = "等级类型（熟练度、百分等级、题目难度）")
    @TableField(value = "level_type")
    private String levelType;

    @ApiModelProperty(value = "等级")
    @TableField(value = "level")
    private String level;

    @ApiModelProperty(value = "取值范围（计算用）")
    @TableField(value = "scope")
    private String scope;

    @ApiModelProperty(value = "描述")
    @TableField(value = "interpret")
    private String interpret;

    @ApiModelProperty(value = "最小边界（展示用）")
    @TableField(value = "min")
    private BigDecimal min;

    @ApiModelProperty(value = "最大边界（展示用）")
    @TableField(value = "max")
    private BigDecimal max;

    public TBCommonLevelConfig(Long id, Long examId, String courseCode, String courseName, String levelType, String level, String scope, String interpret, BigDecimal min, BigDecimal max) {
        this.id = id;
        this.examId = examId;
        this.courseCode = courseCode;
        this.courseName = courseName;
        this.levelType = levelType;
        this.level = level;
        this.scope = scope;
        this.interpret = interpret;
        this.min = min;
        this.max = max;
    }

    public TBCommonLevelConfig() {
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getId() {
        return id;
    }

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

    public Long getExamId() {
        return examId;
    }

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

    public String getCourseCode() {
        return courseCode;
    }

    public void setCourseCode(String courseCode) {
        this.courseCode = courseCode;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getLevelType() {
        return levelType;
    }

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

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getInterpret() {
        return interpret;
    }

    public void setInterpret(String interpret) {
        this.interpret = interpret;
    }

    public BigDecimal getMin() {
        if (Objects.nonNull(min)) {
            return min.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
        } else {
            return min;
        }
    }

    public void setMin(BigDecimal min) {
        this.min = min;
    }

    public BigDecimal getMax() {
        if (Objects.nonNull(max)) {
            return max.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
        } else {
            return max;
        }
    }

    public void setMax(BigDecimal max) {
        this.max = max;
    }
}
