/**
 * 
 */
package org.yacos.core.evaluation;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.yacos.core.article.Article;
import org.yacos.core.users.User;

/**
 * @author christiancorsano
 *
 */
@Entity
public class Report implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	
	private String commentPCMember;
	private String commentAuthor;
	
	@OneToMany(targetEntity=Rating.class,mappedBy="report")//, cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	private List<Rating> ratings;
	
	@ManyToOne(targetEntity=User.class)
	@JoinColumn(name="referee_id",nullable=false)
	private User referee;
	
	@ManyToOne(targetEntity=Article.class)
	@JoinColumn(name="article_id",nullable=false )
	private Article article;
	
	
	/**
	 * @constructor
	 */
	public Report(){
		super();
	}
	
	public Report(String commentPCMember, String commentAuthor,
			List<Rating> ratings, User referee, Article article) {
		super();
		this.commentPCMember = commentPCMember;
		this.commentAuthor = commentAuthor;
		this.ratings = ratings;
		this.referee = referee;
		this.article = article;
	}
	
	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public void setId(Integer id) {
		this.id = id;
	}
	/**
	 * @return the commentPCMember
	 */
	public String getCommentPCMember() {
		return commentPCMember;
	}
	/**
	 * @param commentPCMember the commentPCMember to set
	 */
	public void setCommentPCMember(String commentPCMember) {
		this.commentPCMember = commentPCMember;
	}
	/**
	 * @return the commentAuthor
	 */
	public String getCommentAuthor() {
		return commentAuthor;
	}
	/**
	 * @param commentAuthor the commentAuthor to set
	 */
	public void setCommentAuthor(String commentAuthor) {
		this.commentAuthor = commentAuthor;
	}
	/**
	 * @return the referee
	 */
	@ManyToOne(targetEntity=User.class)
	@JoinColumn(name="referee_id",nullable=false)
	public User getReferee() {
		return referee;
	}
	/**
	 * @param referee the referee to set
	 */
	@ManyToOne(targetEntity=User.class)
	@JoinColumn(name="referee_id",nullable=false)
	public void setReferee(User referee) {
		this.referee = referee;
	}
	/**
	 * @return the article
	 */
	@ManyToOne(targetEntity=Article.class)
	@JoinColumn(name="article_id",nullable=false)
	public Article getArticle() {
		return article;
	}
	/**
	 * @param article the article to set
	 */
	@ManyToOne(targetEntity=Article.class)
	@JoinColumn(name="article_id",nullable=false)
	public void setArticle(Article article) {
		this.article = article;
	}
	
		
	/**
	 * @return the ratings
	 */
	@OneToMany(targetEntity=Rating.class,mappedBy="report")
	public List<Rating> getRatings() {
		return ratings;
	}
	/**
	 * @param ratings the ratings to set
	 */
	@OneToMany(targetEntity=Rating.class,mappedBy="report")
	public void setRatings(List<Rating> ratings) {
		this.ratings = ratings;
	}

	
}
