/*
 * 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 = "giro_tarjeta_debito")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "GiroTarjetaDebito.findAll", query = "SELECT g FROM GiroTarjetaDebito g")
  , @NamedQuery(name = "GiroTarjetaDebito.findById", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.id = :id")
  , @NamedQuery(name = "GiroTarjetaDebito.findByMonto", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.monto = :monto")
  , @NamedQuery(name = "GiroTarjetaDebito.findByComentario", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.comentario = :comentario")
  , @NamedQuery(name = "GiroTarjetaDebito.findByInsertedAt", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.insertedAt = :insertedAt")})
public class GiroTarjetaDebito 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
  private TarjetaDebito tarjetaDebito;
  @JoinColumn(name = "metodo", referencedColumnName = "id")
  @ManyToOne
  private Metodo metodo;

  public GiroTarjetaDebito() {
  }

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

  public GiroTarjetaDebito(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;
  }

  public Metodo getMetodo() {
    return metodo;
  }

  public void setMetodo(Metodo metodo) {
    this.metodo = metodo;
  }

  @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 GiroTarjetaDebito)) {
      return false;
    }
    GiroTarjetaDebito other = (GiroTarjetaDebito) 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.GiroTarjetaDebito[ id=" + id + " ]";
  }
  
}
