/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ryuuji
 */
@Entity
@Table(name = "compra_tarjeta_debito")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "CompraTarjetaDebito.findAll", query = "SELECT c FROM CompraTarjetaDebito c")
  , @NamedQuery(name = "CompraTarjetaDebito.findById", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.id = :id")
  , @NamedQuery(name = "CompraTarjetaDebito.findByMonto", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.monto = :monto")
  , @NamedQuery(name = "CompraTarjetaDebito.findByComentario", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.comentario = :comentario")
  , @NamedQuery(name = "CompraTarjetaDebito.findByInsertedAt", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.insertedAt = :insertedAt")})
public class CompraTarjetaDebito implements Serializable {

  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @Column(name = "id")
  private Integer id;
  @Basic(optional = false)
  @Column(name = "monto")
  private int monto;
  @Column(name = "comentario")
  private String comentario;
  @Basic(optional = false)
  @Column(name = "inserted_at")
  @Temporal(TemporalType.TIMESTAMP)
  private Date insertedAt;
  @JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
  @ManyToOne(optional = false)
  private TarjetaDebito tarjetaDebito;

  public CompraTarjetaDebito() {
  }

  public CompraTarjetaDebito(Integer id) {
    this.id = id;
  }

  public CompraTarjetaDebito(Integer id, int monto, Date insertedAt) {
    this.id = id;
    this.monto = monto;
    this.insertedAt = insertedAt;
  }

  public Integer getId() {
    return id;
  }

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

  public int getMonto() {
    return monto;
  }

  public void setMonto(int monto) {
    this.monto = monto;
  }

  public String getComentario() {
    return comentario;
  }

  public void setComentario(String comentario) {
    this.comentario = comentario;
  }

  public Date getInsertedAt() {
    return insertedAt;
  }

  public void setInsertedAt(Date insertedAt) {
    this.insertedAt = insertedAt;
  }

  public TarjetaDebito getTarjetaDebito() {
    return tarjetaDebito;
  }

  public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
    this.tarjetaDebito = tarjetaDebito;
  }

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

  @Override
  public String toString() {
    return "entities.CompraTarjetaDebito[ id=" + id + " ]";
  }
  
}
