package eu.dnetlib.openaire.db.objects;

import javax.persistence.Column;
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.Table;

import org.hibernate.annotations.Index;

@Entity(name = "participants")
@Table(name = "participants")
public class Participant extends AbstractOpenaireObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2020808539423527717L;
	
	@Id @GeneratedValue(strategy=GenerationType.SEQUENCE)
	@Column(name = "participantID", nullable=false)
	private int participantID;
	
	@Column(name = "participant_number")
	private int participantNumber;
	
	@Column(name = "coordinator", nullable=false, columnDefinition="boolean default=false")
	private boolean coordinator = false;
	
	@ManyToOne
	@JoinColumn(name = "project", nullable=false)
	@Index(name="participants_project_idx")
	private Project project;

	@ManyToOne
	@JoinColumn(name = "resp_organization")
	@Index(name="participants_organization_idx")
	private Organization respOrganization;
	
	@ManyToOne
	@JoinColumn(name = "coordinating_person")
	@Index(name="participants_person_idx")
	private Person coordinatingPerson;

	public int getParticipantID() {
		return participantID;
	}

	public void setParticipantID(int participantID) {
		this.participantID = participantID;
	}

	public boolean isCoordinator() {
		return coordinator;
	}

	public void setCoordinator(boolean coordinator) {
		this.coordinator = coordinator;
	}

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	public int getParticipantNumber() {
		return participantNumber;
	}

	public void setParticipantNumber(int participantNumber) {
		this.participantNumber = participantNumber;
	}

	public Organization getRespOrganization() {
		return respOrganization;
	}

	public void setRespOrganization(Organization respOrganization) {
		this.respOrganization = respOrganization;
	}

	public Person getCoordinatingPerson() {
		return coordinatingPerson;
	}

	public void setCoordinatingPerson(Person coordinatingPerson) {
		this.coordinatingPerson = coordinatingPerson;
	}

	
}
