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

/**
 *
 * @author Shiro
 */
@Entity
@SequenceGenerator(name = "CUPON_CONVENIO_SEQ", sequenceName = "CUPON_CONVENIO_SEQ", allocationSize = 1)
@Table(name = "CUPON_CONVENIO")
public class CuponConvenio implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUPON_CONVENIO_SEQ")
    @Column(name = "CUPONCONVENIO_ID")
    private Integer cuponConvenioID;
    @Column(name = "NUMFOLIOINICIO")
    private Integer folioInicio;
    @Column(name = "NUMFOLIOFINAL")
    private Integer folioFinal;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @JoinColumn(name = "TIPOCONVENIO_ID", referencedColumnName = "TIPOCONVENIO_ID")
    @ManyToOne
    private TipoConvenio tipoConvenio;

    public Boolean getActivo() {
        return activo;
    }

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

    public Integer getCuponConvenioID() {
        return cuponConvenioID;
    }

    public void setCuponConvenioID(Integer cuponConvenioID) {
        this.cuponConvenioID = cuponConvenioID;
    }

    public Date getFecmodif() {
        return fecmodif;
    }

    public void setFecmodif(Date fecmodif) {
        this.fecmodif = fecmodif;
    }

    public Integer getFolioFinal() {
        return folioFinal;
    }

    public void setFolioFinal(Integer folioFinal) {
        this.folioFinal = folioFinal;
    }

    public Integer getFolioInicio() {
        return folioInicio;
    }

    public void setFolioInicio(Integer folioInicio) {
        this.folioInicio = folioInicio;
    }

    public TipoConvenio getTipoConvenio() {
        return tipoConvenio;
    }

    public void setTipoConvenio(TipoConvenio tipoConvenio) {
        this.tipoConvenio = tipoConvenio;
    }

    public Integer getUsuarioId() {
        return usuarioId;
    }

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

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cuponConvenioID != null ? cuponConvenioID.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 CuponConvenio)) {
            return false;
        }
        CuponConvenio other = (CuponConvenio) object;
        if ((this.cuponConvenioID == null && other.cuponConvenioID != null) || (this.cuponConvenioID != null && !this.cuponConvenioID.equals(other.cuponConvenioID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //return "com.rjconsultores.ventaboletos.entidad.CuponConvenio[cuponConvenioID=" + cuponConvenioID + "]";
        return this.getTipoConvenio().getDescTipo();
    }
}
