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 = "GP_PRICING_ESP_PUNTOV_SEQ", sequenceName = "GP_PRICING_ESP_PUNTOV_SEQ", allocationSize = 1)
@Table(name = "GP_PRICING_ESP_PUNTO_VENTA")
public class GP_PricingEspecificoAgencia implements Serializable, Cloneable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "GP_PRICING_ESP_PUNTOV_SEQ")
	@Column(name = "PRICINGESPPUNTOVENTA_ID")
	private Integer pricingEspecificoAgenciaId;
	
	@ManyToOne
	@JoinColumn(name = "PUNTOVENTA_ID",referencedColumnName = "PUNTOVENTA_ID")
	private PuntoVenta puntoVenta;
	
	@Basic(optional = false)
	@Column(name = "ACTIVO")
	private Boolean activo;

	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	
	@Basic(optional = false)
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	
    @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID")
	@ManyToOne
	private GP_PricingEspecifico pricingEspecifico;
    
	public GP_PricingEspecificoAgencia() {
		super();
	}
	public GP_PricingEspecificoAgencia(PuntoVenta puntoVenta, GP_PricingEspecifico pricingEspecifico, Integer usuarioId) {
		super();
		
		this.puntoVenta = puntoVenta;
		this.pricingEspecifico = pricingEspecifico;
		this.usuarioId  = usuarioId;
		this.fecmodif = new Date();
		this.activo = Boolean.TRUE;
	}
	public Integer getPricingEspecificoAgenciaId() {
		return pricingEspecificoAgenciaId;
	}
	public void setPricingEspecificoAgenciaId(Integer pricingEspecificoAgenciaId) {
		this.pricingEspecificoAgenciaId = pricingEspecificoAgenciaId;
	}
	public PuntoVenta getPuntoVenta() {
		return puntoVenta;
	}
	public void setPuntoVenta(PuntoVenta puntoVenta) {
		this.puntoVenta = puntoVenta;
	}
	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;
	}
	public GP_PricingEspecifico getPricingEspecifico() {
		return pricingEspecifico;
	}
	public void setPricingEspecifico(GP_PricingEspecifico pricingEspecifico) {
		this.pricingEspecifico = pricingEspecifico;
	}
	@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 + ((puntoVenta == null) ? 0 : puntoVenta.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;
		GP_PricingEspecificoAgencia other = (GP_PricingEspecificoAgencia) 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 (puntoVenta == null) {
			if (other.puntoVenta != null)
				return false;
		} else if (!puntoVenta.equals(other.puntoVenta))
			return false;
		return true;
	}
	@Override
	protected Object clone() throws CloneNotSupportedException {
		return super.clone();
	}
	@Override
	public String toString() {
		return "[puntoVenta=" + puntoVenta.toString() + " ]";
	}

	
}
