package cn.hmsoft.ltc.model;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Button;

/**
 * 题目
 * 
 * @author xuwenjin
 * @date 2019-03-26 16:09:35
 *
 */
public class Subject {

	private IntegerProperty index;//序号1-N连续
	
	private StringProperty testPaperId;     //试卷编号
	
	private IntegerProperty subjectId;// 编号,主键

	private IntegerProperty courseId;// 课程编号

	private IntegerProperty questionTypeId;// 题型编号

	private StringProperty questionTypeName;// 题型名称

	private StringProperty teachingmterial;// 教材

	private StringProperty ability;// 能力要求

	private StringProperty difficult;// 难度

	private StringProperty assessment;// 考核要求

	private StringProperty status;// 状态

	private IntegerProperty teacherId;// 命题教师


	private StringProperty dry;// 题干

	private StringProperty remark;// 题目描述

	private DoubleProperty score;// 题目分数
	
	private StringProperty subjectContent;// 题目内容,只有填空题此字段有值

	private StringProperty answer;// 答案

	private StringProperty chapter;// 章
	
	private IntegerProperty joint; //节
	
	private IntegerProperty directory;//目
	
	private IntegerProperty pages;//页
	private IntegerProperty tiny_score_flag;//是否显示小题分
	private IntegerProperty ord;//同一题型 同一章节 多个题目之间的 排序号
	private StringProperty quesRemark;//
	// ----
	private StringProperty scoreStr;//分数显示
	//
	protected String typeCaption;// 大题型
	protected String subjectNo;
	protected String courseName;
	protected int questionSum;// 小题数
	protected double questionScores;// 大题总分
	protected String sortNo;// 大题序号
	protected List<SubjectOption> options = new ArrayList<SubjectOption>();

	protected transient Button subjectEditBtn = new Button();
	
	public Subject() {
		this.index = new SimpleIntegerProperty();
		this.testPaperId = new SimpleStringProperty();
		this.subjectId = new SimpleIntegerProperty();
		this.courseId = new SimpleIntegerProperty();
		this.questionTypeId = new SimpleIntegerProperty();
		this.questionTypeName = new SimpleStringProperty("");
		this.teachingmterial = new SimpleStringProperty("");
		this.ability = new SimpleStringProperty("");
		this.difficult = new SimpleStringProperty("");
		this.assessment = new SimpleStringProperty("");
		this.status = new SimpleStringProperty("");
		this.teacherId = new SimpleIntegerProperty();
		this.chapter = new SimpleStringProperty();
		this.joint = new SimpleIntegerProperty();
		this.directory = new SimpleIntegerProperty();
		this.pages = new SimpleIntegerProperty();
		this.dry = new SimpleStringProperty("");
		this.remark = new SimpleStringProperty("");
		this.score = new SimpleDoubleProperty(0);
		this.subjectContent = new SimpleStringProperty("");
		this.answer = new SimpleStringProperty("");
		this.tiny_score_flag = new SimpleIntegerProperty();
		this.ord = new SimpleIntegerProperty();
		this.quesRemark = new SimpleStringProperty();
		this.scoreStr = new SimpleStringProperty();
	}

	public Integer getSubjectId() {
		return subjectId.get();
	}

	public void setSubjectId(Integer subjectId) {
		this.subjectId.set(subjectId);
	}

	public Integer getCourseId() {
		return courseId.get();
	}

	public void setCourseId(Integer courseId) {
		this.courseId.set(courseId);
	}

	public Integer getQuestionTypeId() {
		return questionTypeId.get();
	}

	public void setQuestionTypeId(Integer questionTypeId) {
		this.questionTypeId.set(questionTypeId);
	}

	public String getQuestionTypeName() {
		return questionTypeName.get();
	}

	public void setQuestionTypeName(String questionTypeName) {
		this.questionTypeName.set(questionTypeName);
	}

	public String getTeachingmterial() {
		return teachingmterial.get();
	}

	public void setTeachingmterial(String teachingmterial) {
		this.teachingmterial.set(teachingmterial);
	}

	public String getAbility() {
		return ability.get();
	}

	public void setAbility(String ability) {
		this.ability.set(ability);
	}

	public String getDifficult() {
		return difficult.get();
	}

	public void setDifficult(String difficult) {
		this.difficult.set(difficult);
	}

	public String getAssessment() {
		return assessment.get();
	}

	public void setAssessment(String assessment) {
		this.assessment.set(assessment);
	}

	public String getStatus() {
		return status.get();
	}

	public void setStatus(String status) {
		this.status.set(status);
	}

	public Integer getTeacherId() {
		return teacherId.get();
	}

	public void setTeacherId(Integer teacherId) {
		this.teacherId.set(teacherId);
	}

	public String getChapter() {
		return chapter.get();
	}

	public void setChapter(String chapter) {
		this.chapter.set(chapter);
	}
	
	public Integer getJoint() {
		return joint.get();
	}

	public void setJoint(Integer joint) {
		this.joint.set(joint);
	}
	
	public Integer getDirectory() {
		return directory.get();
	}

	public void setDirectory(Integer directory) {
		this.directory.set(directory);
	}
	
	public Integer getPages() {
		return pages.get();
	}

	public void setPages(Integer pages) {
		this.pages.set(pages);
	}

	public String getDry() {
		return dry.get();
	}

	public void setDry(String dry) {
		this.dry.set(dry);
	}

	public String getAnswer() {
		return answer.get();
	}

	public void setAnswer(String answer) {
		this.answer.set(answer);
	}

	public String getRemark() {
		return remark.get();
	}

	public void setRemark(String remark) {
		this.remark.set(remark);
	}

	public String getSubjectContent() {
		return subjectContent.get();
	}

	public void setSubjectContent(String subjectContent) {
		this.subjectContent.set(subjectContent);
	}

	public Double getScore() {
		return score.get();
	}

	public void setScore(Double soore) {
		this.score.set(soore);
	}

	public List<SubjectOption> getOptions() {
		return options;
	}

	public void setOptions(List<SubjectOption> options) {
		this.options = options;
	}

	public String getSubjectNo() {
		return subjectNo;
	}

	public void setSubjectNo(String subjectNo) {
		this.subjectNo = subjectNo;
	}

	public int getQuestionSum() {
		return questionSum;
	}

	public void setQuestionSum(int questionSum) {
		this.questionSum = questionSum;
	}

	public String getSortNo() {
		return sortNo;
	}

	public void setSortNo(String sortNo) {
		this.sortNo = sortNo;
	}

	public String getCourseName() {
		return courseName;
	}

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

	public double getQuestionScores() {
		return questionScores;
	}

	public void setQuestionScores(double questionScores) {
		this.questionScores = questionScores;
	}

	public String getTypeCaption() {
		return typeCaption;
	}

	public void setTypeCaption(String typeCaption) {
		this.typeCaption = typeCaption;
	}

	public Integer getIndex() {
		return index.get();
	}

	public void setIndex(Integer index) {
		this.index.set(index);
	}

	public int hashCode() {
	     return new HashCodeBuilder(17, 37).
	       append(this.subjectId.get()).
	       append(this.questionTypeId.get()).
	       append(this.courseId.get()).
	       toHashCode();
	}
	
	public boolean equals(Object obj) {
		   if (obj == null) { return false; }
		   if (obj == this) { return true; }
		   if (obj.getClass() != getClass()) {
		     return false;
		   }
		   Subject oth = (Subject) obj;
		   return new EqualsBuilder()
		                 .append(this.subjectId.get(), oth.subjectId.get())
		                 .append(this.questionTypeId.get(), oth.questionTypeId.get())
		                 .append(this.courseId.get(), oth.courseId.get())
		                 .isEquals();
	}
	
	public String getTestPaperId() {
		return testPaperId.get();
	}

	public void setTestPaperId(String testPaperId) {
		this.testPaperId.set(testPaperId);
	}

	public Integer getTiny_score_flag() {
		return tiny_score_flag.get();
	}

	public void setTiny_score_flag(Integer tiny_score_flag) {
		this.tiny_score_flag.set(tiny_score_flag);
	}

	public Integer getOrd() {
		return ord.get();
	}

	public void setOrd(Integer ord) {
		this.ord.set(ord);
	}

	public Button getSubjectEditBtn() {
		return subjectEditBtn;
	}

	public void setSubjectEditBtn(Button subjectEditBtn) {
		this.subjectEditBtn = subjectEditBtn;
	}

	public String getQuesRemark() {
		return quesRemark.get();
	}

	public void setQuesRemark(String quesRemark) {
		this.quesRemark.set(quesRemark);
	}

	public String getScoreStr() {
		return scoreStr.get();
	}

	public void setScoreStr(String scoreStr) {
		this.scoreStr.set(scoreStr);
	}
}
