/**
 * 
 */
package de.bstly.board.model;

import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.google.common.collect.Lists;

/**
 * The Class Bookmarks.
 */
@Entity
@Table(name = "bookmarks")
@EntityListeners({ AuditingEntityListener.class })
public class Bookmarks {

	@Id
	@Column(name = "username", nullable = false)
	private String username;
	@ElementCollection
	@LazyCollection(LazyCollectionOption.FALSE)
	@CollectionTable(name = "bookmark_entries")
	private List<Long> entries;

	/**
	 * Instantiates a new bookmarks.
	 */
	public Bookmarks() {
		super();
	}

	/**
	 * Instantiates a new bookmarks.
	 *
	 * @param username the username
	 */
	public Bookmarks(String username) {
		super();
		this.username = username;
		this.entries = Lists.newArrayList();
	}

	/**
	 * Gets the username.
	 *
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * Sets the username.
	 *
	 * @param username the new username
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * Gets the entries.
	 *
	 * @return the entries
	 */
	public List<Long> getEntries() {
		return entries;
	}

	/**
	 * Sets the entries.
	 *
	 * @param entries the new entries
	 */
	public void setEntries(List<Long> entries) {
		this.entries = entries;
	}

}
