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
@SequenceGenerator(name = "PRICING_ESP_CATEGORIA_SEQ", sequenceName = "PRICING_ESP_CATEGORIA_SEQ", allocationSize = 1)
@Table(name = "PRICING_ESPECIFICO_CATEGORIA")
public class PricingEspecificoCategoria implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer pricingEspecificoCategoriaId;
	private PricingEspecifico pricingEspecifico;
	private Categoria categoria;
	private Boolean activo;
	private Date fecmodif;
	private Integer usuarioId;

	public PricingEspecificoCategoria() {
		super();
	}

	public PricingEspecificoCategoria(Categoria categoria, PricingEspecifico pricingEspecifico, Integer usuarioId) {
		this.pricingEspecifico = pricingEspecifico;
		this.categoria = categoria;
		this.usuarioId = usuarioId;
		this.activo = true;
		this.fecmodif = new Date();
	}

	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESP_CATEGORIA_SEQ")
	@Column(name = "PRICINGESPECIFICO_CATEGORIAID")
	public Integer getPricingEspecificoCategoriaId() {
		return pricingEspecificoCategoriaId;
	}

	public void setPricingEspecificoCategoriaId(Integer pricingEspecificoCategoriaId) {
		this.pricingEspecificoCategoriaId = pricingEspecificoCategoriaId;
	}

	@JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID")
	@ManyToOne
	public PricingEspecifico getPricingEspecifico() {
		return pricingEspecifico;
	}

	public void setPricingEspecifico(PricingEspecifico pricingEspecifico) {
		this.pricingEspecifico = pricingEspecifico;
	}

	@ManyToOne
	@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
	public Categoria getCategoria() {
		return categoria;
	}

	public void setCategoria(Categoria categoria) {
		this.categoria = categoria;
	}

	@Column(name = "ACTIVO")
	public Boolean getActivo() {
		return activo;
	}

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

	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getFecmodif() {
		return fecmodif;
	}

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

	@Basic(optional = false)
	@Column(name = "USUARIO_ID")
	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 + ((activo == null) ? 0 : activo.hashCode());
		result = prime * result + ((pricingEspecifico == null) ? 0 : pricingEspecifico.hashCode());
		result = prime * result + ((categoria == null) ? 0 : categoria.hashCode());
		return result;
	}

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

}
