/*
 * 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 = "pago_tarjeta_credito")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "PagoTarjetaCredito.findAll", query = "SELECT p FROM PagoTarjetaCredito p")
  , @NamedQuery(name = "PagoTarjetaCredito.findById", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.id = :id")
  , @NamedQuery(name = "PagoTarjetaCredito.findByMonto", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.monto = :monto")
  , @NamedQuery(name = "PagoTarjetaCredito.findByComentario", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.comentario = :comentario")
  , @NamedQuery(name = "PagoTarjetaCredito.findByInsertedAt", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.insertedAt = :insertedAt")})
public class PagoTarjetaCredito 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_credito", referencedColumnName = "id")
  @ManyToOne
  private TarjetaCredito tarjetaCredito;

  public PagoTarjetaCredito() {
  }

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

  public PagoTarjetaCredito(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 TarjetaCredito getTarjetaCredito() {
    return tarjetaCredito;
  }

  public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
    this.tarjetaCredito = tarjetaCredito;
  }

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