/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
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 org.hibernate.Hibernate;

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

/**
 *
 * @author Rafael
 */
@AuditarClasse(nome = "PtovtaHorario", tela = "auditarClasse.PtovtaHorario")
@Entity
@SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1)
@Table(name = "PTOVTA_HORARIO")

public class PtovtaHorario implements Serializable, Auditavel<PtovtaHorario>  {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_HORARIO_SEQ")
    @Column(name = "PTOVTAHORARIO_ID")
    private Integer ptovtaHorarioId;
   
    @Column(name = "INICIO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date inicio;
    
    @Column(name = "FIM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fim;
    
   
    @Column(name = "ACTIVO")
    private Boolean activo;
    
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
   
    @Column(name = "USUARIO_ID")
    private int usuarioId;
    
    @NaoAuditar
    @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
    @ManyToOne
    private PuntoVenta puntoventaId;
    
    @Transient
	@NaoAuditar
	private PtovtaHorario ptovtaHorarioClone;
    
    @Column(name = "INDLUNES")
	private Boolean indlunes;
	@Column(name = "INDMARTES")
	private Boolean indmartes;
	@Column(name = "INDMIERCOLES")
	private Boolean indmiercoles;
	@Column(name = "INDJUEVES")
	private Boolean indjueves;
	@Column(name = "INDVIERNES")
	private Boolean indviernes;
	@Column(name = "INDSABADO")
	private Boolean indsabado;
	@Column(name = "INDDOMINGO")
	private Boolean inddomingo;

    public PtovtaHorario() {
    }

    public PtovtaHorario(Integer ptovtaHorarioId) {
        this.ptovtaHorarioId = ptovtaHorarioId;
    }

    public PtovtaHorario(Integer ptovtaHorarioId, Date inicio, Date fim, Boolean activo, Date fecmodif, int usuarioId) {
        this.ptovtaHorarioId = ptovtaHorarioId;
        this.inicio = inicio;
        this.fim = fim;
        this.activo = activo;
        this.fecmodif = fecmodif;
        this.usuarioId = usuarioId;
    }

   

    public Integer getPtovtaHorarioId() {
		return ptovtaHorarioId;
	}

	public void setPtovtaHorarioId(Integer ptovtaHorarioId) {
		this.ptovtaHorarioId = ptovtaHorarioId;
	}

	public Date getInicio() {
        return inicio;
    }

    public void setInicio(Date inicio) {
        this.inicio = inicio;
    }

    public Date getFim() {
        return fim;
    }

    public void setFim(Date fim) {
        this.fim = fim;
    }

    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 int getUsuarioId() {
        return usuarioId;
    }

    public void setUsuarioId(int usuarioId) {
        this.usuarioId = usuarioId;
    }

    public PuntoVenta getPuntoventaId() {
        return puntoventaId;
    }

    public void setPuntoventaId(PuntoVenta puntoventaId) {
        this.puntoventaId = puntoventaId;
    }
    
    public Boolean getIndlunes() {
		return indlunes;
	}

	public void setIndlunes(Boolean indlunes) {
		this.indlunes = indlunes;
	}

	public Boolean getIndmartes() {
		return indmartes;
	}

	public void setIndmartes(Boolean indmartes) {
		this.indmartes = indmartes;
	}

	public Boolean getIndmiercoles() {
		return indmiercoles;
	}

	public void setIndmiercoles(Boolean indmiercoles) {
		this.indmiercoles = indmiercoles;
	}

	public Boolean getIndjueves() {
		return indjueves;
	}

	public void setIndjueves(Boolean indjueves) {
		this.indjueves = indjueves;
	}

	public Boolean getIndviernes() {
		return indviernes;
	}

	public void setIndviernes(Boolean indviernes) {
		this.indviernes = indviernes;
	}

	public Boolean getIndsabado() {
		return indsabado;
	}

	public void setIndsabado(Boolean indsabado) {
		this.indsabado = indsabado;
	}

	public Boolean getInddomingo() {
		return inddomingo;
	}

	public void setInddomingo(Boolean inddomingo) {
		this.inddomingo = inddomingo;
	}
	
	@Override
	public void clonar() throws CloneNotSupportedException {
		ptovtaHorarioClone = new PtovtaHorario();
		ptovtaHorarioClone = (PtovtaHorario) this.clone();
		Hibernate.initialize(ptovtaHorarioClone.getPuntoventaId());
		
	}

	@Override
	public PtovtaHorario getCloneObject() throws CloneNotSupportedException {
		return ptovtaHorarioClone;
	}

	@Override
	public String getTextoInclusaoExclusao() {
		return String.format("ID [%s]", getPtovtaHorarioId());
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ptovtaHorarioId != null ? ptovtaHorarioId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PtovtaHorario)) {
            return false;
        }
        PtovtaHorario other = (PtovtaHorario) object;
        if ((this.ptovtaHorarioId == null && other.ptovtaHorarioId != null) || (this.ptovtaHorarioId != null && !this.ptovtaHorarioId.equals(other.ptovtaHorarioId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rjconsultores.ventaboletos.entidad.PtovtaHorario[ ptovtaHorarioId=" + ptovtaHorarioId + " ]";
    }
    
}
