/**
 * 
 */
package com.rjconsultores.ventaboletos.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
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.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Bruno Neves
 *
 */
@Entity
@SequenceGenerator(name = "PRECIO_FIXO_PEDAGIO_SEQ", sequenceName = "PRECIO_FIXO_PEDAGIO_SEQ", allocationSize = 1)
@Table(name = "PRECIO_FIXO_PEDAGIO")
public class PrecioFixoPedagio implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECIO_FIXO_PEDAGIO_SEQ")
	@Column(name = "PRECIOFIXOPEDAGIO_ID")
	private Integer precioFixoId;
	
	@ManyToOne
	@JoinColumn(name = "PRACAPEDAGIO_ID", referencedColumnName = "CASETAPEAJE_ID")
	private CasetaPeaje pracaPedagioId;
	
	@OneToOne
	@JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
	private OrgaoConcedente orgaoConcedenteId;
	
	@OneToOne
	@JoinColumn(name = "CLASSESERVICO_ID", referencedColumnName = "CLASESERVICIO_ID")
	private ClaseServicio classeId;
	
	@Column(name = "VALORFIXO")
	private BigDecimal valorFixo;
	
	@Column(name = "ACTIVO")
	private Boolean activo;
	
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;


	public Integer getPrecioFixoId() {
		return precioFixoId;
	}

	public void setPrecioFixoId(Integer precioFixoId) {
		this.precioFixoId = precioFixoId;
	}

	public CasetaPeaje getPracaPedagioId() {
		return pracaPedagioId;
	}

	public void setPracaPedagioId(CasetaPeaje pracaPedagioId) {
		this.pracaPedagioId = pracaPedagioId;
	}

	public OrgaoConcedente getOrgaoConcedenteId() {
		return orgaoConcedenteId;
	}

	public void setOrgaoConcedenteId(OrgaoConcedente orgaoConcedenteId) {
		this.orgaoConcedenteId = orgaoConcedenteId;
	}

	public ClaseServicio getClasseId() {
		return classeId;
	}

	public void setClasseId(ClaseServicio classeId) {
		this.classeId = classeId;
	}

	public BigDecimal getValorFixo() {
		return valorFixo;
	}

	public void setValorFixo(BigDecimal valorFixo) {
		this.valorFixo = valorFixo;
	}
	
		
	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 + ((classeId == null) ? 0 : classeId.hashCode());
		result = prime * result + ((orgaoConcedenteId == null) ? 0 : orgaoConcedenteId.hashCode());
		result = prime * result + ((pracaPedagioId == null) ? 0 : pracaPedagioId.hashCode());
		result = prime * result + ((precioFixoId == null) ? 0 : precioFixoId.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;
		PrecioFixoPedagio other = (PrecioFixoPedagio) obj;
		if (classeId == null) {
			if (other.classeId != null)
				return false;
		} else if (!classeId.equals(other.classeId))
			return false;
		if (orgaoConcedenteId == null) {
			if (other.orgaoConcedenteId != null)
				return false;
		} else if (!orgaoConcedenteId.equals(other.orgaoConcedenteId))
			return false;
		if (pracaPedagioId == null) {
			if (other.pracaPedagioId != null)
				return false;
		} else if (!pracaPedagioId.equals(other.pracaPedagioId))
			return false;
		if (precioFixoId == null) {
			if (other.precioFixoId != null)
				return false;
		} else if (!precioFixoId.equals(other.precioFixoId))
			return false;
		return true;
	}

	
	
}
