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;
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;

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

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_VENDAWEB_SEQ")
	@Column(name = "CONFRESTRICAOVENDAWEB_ID")
	private Integer confRestricaoVendaWebId;
	@ManyToOne
	@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
	private Empresa empresa;
	@Column(name = "valor")
	private Double valor;
	
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@NaoAuditar
	@Transient
	private ConfRestricaoVendaWeb confRestricaoVendaWebClone;
	
	public Integer getConfRestricaoVendaWebId() {
		return confRestricaoVendaWebId;
	}
	public void setConfRestricaoVendaWebId(Integer confRestricaoVendaWebId) {
		this.confRestricaoVendaWebId = confRestricaoVendaWebId;
	}
	public Empresa getEmpresa() {
		return empresa;
	}
	public void setEmpresa(Empresa empresa) {
		this.empresa = empresa;
	}
	public Double getValor() {
		return valor;
	}
	public void setValor(Double valor) {
		this.valor = valor;
	}
	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 void clonar() throws CloneNotSupportedException {
		
		confRestricaoVendaWebClone = new ConfRestricaoVendaWeb();
		confRestricaoVendaWebClone = (ConfRestricaoVendaWeb) this.clone();

	}

	@Override
	public ConfRestricaoVendaWeb getCloneObject() throws CloneNotSupportedException {
		return confRestricaoVendaWebClone;
	}

	@Override
	public String getTextoInclusaoExclusao() {
		return String.format("ID [%s]", "Empresa: "+getEmpresa().getNombempresa()+"- Valor: "+getValor());
	}

}
