package com.rjconsultores.ventaboletos.entidad;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
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.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "PACOTE_ITEM")
@SequenceGenerator(name = "PACOTE_ITEM_SEQ", sequenceName = "PACOTE_ITEM_SEQ", allocationSize = 1)
public class PacoteItem implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_ITEM_SEQ")
	@Column(name = "PACOTEITEM_ID")
	private Integer pacoteItemId;
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@JoinColumn(name = "PACOTE_ID", referencedColumnName = "PACOTE_ID")
	@ManyToOne
	private Pacote pacote;
	@JoinColumn(name = "ITEMADICIONAL_ID", referencedColumnName = "ITEMADICIONAL_ID")
	@ManyToOne
	private ItemAdicional itemAdicional;

	public PacoteItem() {
		super();
	}

	public Integer getPacoteItemId() {
		return pacoteItemId;
	}

	public void setPacoteItemId(Integer pacoteItemId) {
		this.pacoteItemId = pacoteItemId;
	}

	public Boolean getActivo() {
		return activo;
	}

	public void setActivo(Boolean activo) {
		this.activo = activo;
	}

	public Date getFecmodif() {
		return fecmodif;
	}

	public void setFecmodif(Date fecmodif) {
		this.fecmodif = fecmodif;
	}

	public Integer getUsuarioId() {
		return usuarioId;
	}

	public void setUsuarioId(Integer usuarioId) {
		this.usuarioId = usuarioId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pacoteItemId == null) ? 0 : pacoteItemId.hashCode());
		return result;
	}

	public Pacote getPacote() {
		return pacote;
	}

	public void setPacote(Pacote pacote) {
		this.pacote = pacote;
	}

	public ItemAdicional getItemAdicional() {
		return itemAdicional;
	}

	public void setItemAdicional(ItemAdicional itemAdicional) {
		this.itemAdicional = itemAdicional;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PacoteItem other = (PacoteItem) obj;
		if (pacoteItemId == null) {
			if (other.pacoteItemId != null)
				return false;
		} else if (!pacoteItemId.equals(other.pacoteItemId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "PacoteItem [pacoteItemId=" + pacoteItemId + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pacoteId=" + pacote + ", itemadicionalId=" + itemAdicional + "]";
	}

}
