/*
 * 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 = "transferencia_tarjeta_debito")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "TransferenciaTarjetaDebito.findAll", query = "SELECT t FROM TransferenciaTarjetaDebito t")
  , @NamedQuery(name = "TransferenciaTarjetaDebito.findById", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.id = :id")
  , @NamedQuery(name = "TransferenciaTarjetaDebito.findByMonto", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.monto = :monto")
  , @NamedQuery(name = "TransferenciaTarjetaDebito.findByComentario", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.comentario = :comentario")
  , @NamedQuery(name = "TransferenciaTarjetaDebito.findByInsertedAt", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.insertedAt = :insertedAt")})
public class TransferenciaTarjetaDebito 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_from", referencedColumnName = "id")
  @ManyToOne
  private TarjetaDebito tarjetaDebitoFrom;
  @JoinColumn(name = "tarjeta_debito_to", referencedColumnName = "id")
  @ManyToOne
  private TarjetaDebito tarjetaDebitoTo;

  public TransferenciaTarjetaDebito() {
  }

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

  public TransferenciaTarjetaDebito(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 getTarjetaDebitoFrom() {
    return tarjetaDebitoFrom;
  }

  public void setTarjetaDebitoFrom(TarjetaDebito tarjetaDebitoFrom) {
    this.tarjetaDebitoFrom = tarjetaDebitoFrom;
  }

  public TarjetaDebito getTarjetaDebitoTo() {
    return tarjetaDebitoTo;
  }

  public void setTarjetaDebitoTo(TarjetaDebito tarjetaDebitoTo) {
    this.tarjetaDebitoTo = tarjetaDebitoTo;
  }

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