/*
 * 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 java.util.List;
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.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ryuuji
 */
@Entity
@Table(name = "tarjeta_credito")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "TarjetaCredito.findAll", query = "SELECT t FROM TarjetaCredito t")
  , @NamedQuery(name = "TarjetaCredito.findById", query = "SELECT t FROM TarjetaCredito t WHERE t.id = :id")
  , @NamedQuery(name = "TarjetaCredito.findByLimiteNacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteNacional = :limiteNacional")
  , @NamedQuery(name = "TarjetaCredito.findByLimiteInternacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteInternacional = :limiteInternacional")
  , @NamedQuery(name = "TarjetaCredito.findByInsertedAt", query = "SELECT t FROM TarjetaCredito t WHERE t.insertedAt = :insertedAt")})
public class TarjetaCredito 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 = "limite_nacional")
  private int limiteNacional;
  @Basic(optional = false)
  @Column(name = "limite_internacional")
  private int limiteInternacional;
  @Basic(optional = false)
  @Column(name = "deuda_nacional")
  private int deudaNacional;
  @Basic(optional = false)
  @Column(name = "deuda_internacional")
  private int deudaInternacional;
  @Basic(optional = false)
  @Column(name = "inserted_at")
  @Temporal(TemporalType.TIMESTAMP)
  private Date insertedAt;
  @JoinColumn(name = "cliente", referencedColumnName = "id")
  @ManyToOne(optional = false)
  private Cliente cliente;
  @OneToMany(mappedBy = "tarjetaCredito")
  private List<PagoTarjetaCredito> pagoList;
  @OneToMany(mappedBy = "tarjetaCredito")
  private List<CompraTarjetaCredito> compraList;

  public TarjetaCredito() {
  }

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

  public TarjetaCredito(Integer id, int limiteNacional, int limiteInternacional, Date insertedAt) {
    this.id = id;
    this.limiteNacional = limiteNacional;
    this.limiteInternacional = limiteInternacional;
    this.insertedAt = insertedAt;
  }

  public Integer getId() {
    return id;
  }

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

  public int getLimiteNacional() {
    return limiteNacional;
  }

  public void setLimiteNacional(int limiteNacional) {
    this.limiteNacional = limiteNacional;
  }

  public int getLimiteInternacional() {
    return limiteInternacional;
  }

  public void setLimiteInternacional(int limiteInternacional) {
    this.limiteInternacional = limiteInternacional;
  }

  public int getDeudaNacional() {
    return deudaNacional;
  }

  public int getDeudaInternacional() {
    return deudaInternacional;
  }

  public Date getInsertedAt() {
    return insertedAt;
  }

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

  public Cliente getCliente() {
    return cliente;
  }

  public void setCliente(Cliente cliente) {
    this.cliente = cliente;
  }

  @XmlTransient
  public List<PagoTarjetaCredito> getPagoList() {
    return pagoList;
  }

  public void setPagoList(List<PagoTarjetaCredito> pagoList) {
    this.pagoList = pagoList;
  }

  @XmlTransient
  public List<CompraTarjetaCredito> getCompraList() {
    return compraList;
  }

  public void setCompraList(List<CompraTarjetaCredito> compraList) {
    this.compraList = compraList;
  }

  public void setDeudaNacional(int deudaNacional) {
    this.deudaNacional = deudaNacional;
  }

  public void setDeudaInternacional(int deudaInternacional) {
    this.deudaInternacional = deudaInternacional;
  }

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