package cn.com.qmth.examcloud.core.questions.dao.entity;

import cn.com.qmth.examcloud.core.questions.dao.entity.base.IdEntity;
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyDto;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * @author weiwenhai
 * @describle 课程属性
 * @date 2017.11.2
 */
@Entity
@Table(name = "ecs_ques_course_property")
public class CourseProperty extends IdEntity {
    @NotNull
    private String name;

    @NotNull
    private Long courseId;

    @NotNull
    private Long orgId;

    private String courseCode;

    private Boolean enable;

    private String courseName;

    public CourseProperty() {

    }

    public CourseProperty(CoursePropertyDto coursePropertyDto) {
        this.id = coursePropertyDto.getId();
        this.name = coursePropertyDto.getName();
        this.courseId = coursePropertyDto.getCourseId();
        this.orgId = coursePropertyDto.getOrgId();
        this.courseCode = coursePropertyDto.getCourseCode();
        if (coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("0")) {
            this.enable = false;
        } else if (coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("1")) {
            this.enable = true;
        } else {
            this.enable = null;
        }
    }

    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 Long getCourseId() {
        return courseId;
    }

    public void setCourseId(Long courseId) {
        this.courseId = courseId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    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;
    }

}