package com.rjconsultores.ventaboletos.entidad;

import java.io.Serializable;
import java.math.BigDecimal;

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 org.apache.commons.lang.builder.EqualsBuilder;

@Entity
@SequenceGenerator(name = "CLASSE_INDICE_PEAJE_SEQ", sequenceName = "CLASSE_INDICE_PEAJE_SEQ", initialValue = 1)
@Table(name = "CLASSE_INDICE_PEAJE")
public class ClasseIndicePeaje implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "CLASSE_INDICE_PEAJE_ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASSE_INDICE_PEAJE_SEQ")
	private Long id;

	@Column
	private Boolean activo;

	@OneToOne
	@JoinColumn(name = "CLASSE_SERVICIO_ID")
	private ClaseServicio classeServicio;

	@ManyToOne
	@JoinColumn(name = "ORGAOCONCEDENTE_ID")
	private OrgaoConcedente orgaoConcedente;

	@Column(name = "INDICE_PEAJE")
	private BigDecimal indicePeaje;

	public Long getId() { 
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Boolean getActivo() {
		return activo;
	}

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

	public ClaseServicio getClasseServicio() {
		return classeServicio;
	}

	public void setClasseServicio(ClaseServicio classeServicio) {
		this.classeServicio = classeServicio;
	}

	public OrgaoConcedente getOrgaoConcedente() {
		return orgaoConcedente;
	}

	public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) {
		this.orgaoConcedente = orgaoConcedente;
	}

	public BigDecimal getIndicePeaje() {
		return indicePeaje;
	}

	public void setIndicePeaje(BigDecimal indicePeaje) {
		this.indicePeaje = indicePeaje;
	}

	@Override
	public boolean equals(Object obj) {
		return new EqualsBuilder().append(this.id, ((ClasseIndicePeaje) obj).getId()).isEquals();
	}

	@Override
	public String toString() {
		return classeServicio.getDescclase() + " " + indicePeaje.toString();
	}
}
