package com.eassessment.pojo;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

 
@Entity
@Table(name = "questions")
public class Questions {

	@Id
	@GeneratedValue
	int question_id;
	
	@Column(name = "question_name", nullable = false, length=1000) 
	String question_name;
	
	@Column(name = "sub_topic_from_book", nullable = false) 
	String sub_topic_from_book;
	
	@Column(name = "question_type", nullable = false) 
	String question_type;
	
	@ManyToOne
	@JoinColumn(name="topicid")
	Topics topics;

	@OneToMany(targetEntity = Options.class, mappedBy = "questions", cascade = CascadeType.ALL )
	@LazyCollection(LazyCollectionOption.FALSE) 
	List<Options> options;

	public int getQuestion_id() {
		return question_id;
	}

	public void setQuestion_id(int question_id) {
		this.question_id = question_id;
	}

	public String getQuestion_name() {
		return question_name;
	}

	public void setQuestion_name(String question_name) {
		this.question_name = question_name;
	}

	public Topics getTopic() {
		return topics;
	}

	public void setTopic(Topics topics) {
		this.topics = topics;
	}

	public List<Options> getOption() {
		return options;
	}

	public void setOption(List<Options> options) {
		this.options = options;
	}

	public String getSub_topic_from_book() {
		return sub_topic_from_book;
	}

	public void setSub_topic_from_book(String sub_topic_from_book) {
		this.sub_topic_from_book = sub_topic_from_book;
	}

	public String getQuestion_type() {
		return question_type;
	}

	public void setQuestion_type(String question_type) {
		this.question_type = question_type;
	}

	@Override
	public String toString() {
		return "Questions [question_id=" + question_id + ", question_name="
				+ question_name + ", sub_topic_from_book="
				+ sub_topic_from_book + ", question_type=" + question_type
				+ "]";
	}

	 	
	
}
