/*
 * 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.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ryuuji
 */
@Entity
@Table(name = "linea_sobregiro")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "LineaSobregiro.findAll", query = "SELECT l FROM LineaSobregiro l")
  , @NamedQuery(name = "LineaSobregiro.findById", query = "SELECT l FROM LineaSobregiro l WHERE l.id = :id")
  , @NamedQuery(name = "LineaSobregiro.findBySobregiro", query = "SELECT l FROM LineaSobregiro l WHERE l.sobregiro = :sobregiro")
  , @NamedQuery(name = "LineaSobregiro.findByLimite", query = "SELECT l FROM LineaSobregiro l WHERE l.limite = :limite")
  , @NamedQuery(name = "LineaSobregiro.findByInsertedAt", query = "SELECT l FROM LineaSobregiro l WHERE l.insertedAt = :insertedAt")})
public class LineaSobregiro 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 = "sobregiro")
  private int sobregiro;
  @Basic(optional = false)
  @Column(name = "limite")
  private int limite;
  @Basic(optional = false)
  @Column(name = "inserted_at")
  @Temporal(TemporalType.TIMESTAMP)
  private Date insertedAt;
  @OneToOne(cascade = CascadeType.ALL, mappedBy = "lineaSobregiro")
  private Cliente cliente;

  public LineaSobregiro() {
  }

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

  public LineaSobregiro(Integer id, int sobregiro, int limite, Date insertedAt) {
    this.id = id;
    this.sobregiro = sobregiro;
    this.limite = limite;
    this.insertedAt = insertedAt;
  }

  public Integer getId() {
    return id;
  }

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

  public int getSobregiro() {
    return sobregiro;
  }

  public void setSobregiro(int sobregiro) {
    this.sobregiro = sobregiro;
  }

  public int getLimite() {
    return limite;
  }

  public void setLimite(int limite) {
    this.limite = limite;
  }

  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;
  }

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