package eu.dnetlib.data.is.vocabulary.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import com.vladmihalcea.hibernate.type.json.JsonStringType;

@Entity
@Table(name = "vocabulary_terms")
@IdClass(VocabularyTermPK.class)
@TypeDefs({
	@TypeDef(name = "json", typeClass = JsonStringType.class),
	@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class VocabularyTerm implements Serializable {

	private static final long serialVersionUID = -3995855638130512114L;

	@Id
	@Column(name = "code")
	private String code;

	@Id
	@Column(name = "vocabulary")
	private String vocabulary;

	@Column(name = "name")
	private String name;

	@Column(name = "encoding")
	private String encoding;

	@Type(type = "jsonb")
	@Column(name = "synonyms", columnDefinition = "jsonb")
	private Synonym[] synonyms;

	public String getCode() {
		return code;
	}

	public void setCode(final String code) {
		this.code = code;
	}

	public String getVocabulary() {
		return vocabulary;
	}

	public void setVocabulary(final String vocabulary) {
		this.vocabulary = vocabulary;
	}

	public String getName() {
		return name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	public String getEncoding() {
		return encoding;
	}

	public void setEncoding(final String encoding) {
		this.encoding = encoding;
	}

	public Synonym[] getSynonyms() {
		return synonyms;
	}

	public void setSynonyms(final Synonym[] synonyms) {
		this.synonyms = synonyms;
	}

}
