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

import br.com.rjconsultores.auditador.annotations.AuditarClasse;
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
import br.com.rjconsultores.auditador.interfaces.Auditavel;

@AuditarClasse(nome = "CoeficienteTarifa", tela = "auditarClasse.CoeficienteTarifa")
@Entity
@SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1)
@Table(name = "COEFICIENTE_TARIFA")
public class CoeficienteTarifa  implements Serializable, Auditavel<CoeficienteTarifa> {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "COEFICIENTE_TARIFA_SEQ")
	@Column(name = "COEFICIENTETARIFA_ID")
	private Integer coeficienteId;
	@Column(name = "DESCCOEFICIENTE")
	private String descCoeficiente;
	@Column(name = "COEFICIENTE")
	private BigDecimal coeficiente;
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	
	@Transient
	@NaoAuditar
	private CoeficienteTarifa coeficienteTarifaClone;

	public Integer getCoeficienteId() {
		return coeficienteId;
	}

	public void setCoeficienteId(Integer coeficienteId) {
		this.coeficienteId = coeficienteId;
	}

	public String getDescCoeficiente() {
		return descCoeficiente;
	}

	public void setDescCoeficiente(String descCoeficiente) {
		this.descCoeficiente = descCoeficiente;
	}

	public BigDecimal getCoeficiente() {
		return coeficiente;
	}

	public void setCoeficiente(BigDecimal coeficiente) {
		this.coeficiente = coeficiente;
	}

	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 CoeficienteTarifa getCloneObject() throws CloneNotSupportedException {
		return coeficienteTarifaClone;
	}

	@Override
	public String getTextoInclusaoExclusao() {
		return String.format("ID [%s]", getCoeficienteId());
	}
	
	@Override
	public void clonar() throws CloneNotSupportedException {
		coeficienteTarifaClone = new CoeficienteTarifa();
		coeficienteTarifaClone = (CoeficienteTarifa) this.clone();

	}

	@Override
	public String toString() {
		return descCoeficiente + " - " + coeficiente;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((coeficienteId == null) ? 0 : coeficienteId.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;
		CoeficienteTarifa other = (CoeficienteTarifa) obj;
		if (coeficienteId == null) {
			if (other.coeficienteId != null)
				return false;
		} else if (!coeficienteId.equals(other.coeficienteId))
			return false;
		return true;
	}
}
