/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.arrebol.taxiservicios.model.predio;

import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.GenericEnumType;
import com.arrebol.taxiservicios.model.enums.TipoAbono;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @author pc one
 */
@Entity
@Table(name = "abono_lote")
public class AbonoLote implements Serializable {

    private static final long serialVersionUID = -6653037938225719593L;

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    @Column(name = "id", length = 36)
    private String id;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "id_lote",
            referencedColumnName = "id",
            nullable = false
    )
    private Lote lote;

    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "id_cliente",
            referencedColumnName = "id",
            nullable = true
    )
    private Person cliente;

    @Enumerated(EnumType.STRING)
    @Column(name = "tipo_abono", nullable = false)
    private TipoAbono tipoAbono;

    @Enumerated(EnumType.STRING)
    @Column(name = "estatus_activo", nullable = false)
    private GenericEnumType estatusActivo;

    @Enumerated(EnumType.STRING)
    @Column(name = "pago_estatus", nullable = false)
    private GenericEnumType pagoEstatus;

    @Column(name = "convenio", nullable = false)
    private int convenio;

    @Column(name = "pago_juridico", nullable = false)
    private int pagoJuridico;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "fecha_a_pagar")
    private Date fechaAPagar;

    @Column(name = "pago", nullable = true)
    private Double pago;

    @Column(name = "saldo_anterior", nullable = true)
    private Double saldoAnterior;

    @Column(name = "saldo_nuevo", nullable = true)
    private Double saldoNuevo;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_on")
    private Date createdOn;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(
            name = "created_by",
            referencedColumnName = "id",
            nullable = false
    )
    private User createdBy;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "last_updated_on")
    private Date lastUpdatedOn;

    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "last_updated_by",
            referencedColumnName = "id",
            nullable = true
    )
    private User lastUpdatedBy;

    @Column(name = "cantidad_pagada", nullable = true)
    private Double cantidadPagada;

    @Column(name = "diferencia_pago", nullable = true)
    private Double diferenciaPago;

    @Column(name = "descripcion", nullable = true)
    private String descripcion;

    @Column(name = "mandado_pagado")
    private Double mandadoPagado;

    @Column(name = "mandado_a_pagar")
    private Double mandadoPagar;

    @Column(name = "cobranza_pagada")
    private Double cobranzaPagada;

    @Column(name = "cobranza_a_pagar")
    private Double cobranzaPagar;

    @Transient
    private String numeroAbono;

    @Column(name = "pago_extra")
    private Double pagoExtra;

    @Temporal(TemporalType.DATE)
    @Column(name = "fecha_pago_extra")
    private Date fechaPagoExtra;

    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "id_user_pago_extra",
            referencedColumnName = "id",
            nullable = true
    )
    private User userPagoExtra;

    @Column(name = "folio")
    private String folio;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(
            name = "id_abono_multiple",
            referencedColumnName = "id",
            nullable = true
    )
    private HitorialAbonoMultiple abonoMultiple;

    public AbonoLote() {
    }

    public AbonoLote(String id, Lote lote, Person cliente, TipoAbono tipoAbono, GenericEnumType estatusActivo, GenericEnumType pagoEstatus, Date fechaAPagar, Double pago, Double saldoAnterior, Double saldoNuevo, Date createdOn, User createdBy, Date lastUpdatedOn, User lastUpdatedBy, Double cantidadPagada) {
        this.id = id;
        this.lote = lote;
        this.cliente = cliente;
        this.tipoAbono = tipoAbono;
        this.estatusActivo = estatusActivo;
        this.pagoEstatus = pagoEstatus;
        this.fechaAPagar = fechaAPagar;
        this.pago = pago;
        this.saldoAnterior = saldoAnterior;
        this.saldoNuevo = saldoNuevo;
        this.createdOn = createdOn;
        this.createdBy = createdBy;
        this.lastUpdatedOn = lastUpdatedOn;
        this.lastUpdatedBy = lastUpdatedBy;
        this.cantidadPagada = cantidadPagada;
    }

    @Override
    public String toString() {
        return "AbonoLote{" + "id=" + id + ", lote=" + lote + '}';
    }

    public AbonoLote(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

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

    public Lote getLote() {
        return lote;
    }

    public void setLote(Lote lote) {
        this.lote = lote;
    }

    public Person getCliente() {
        return cliente;
    }

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

    public TipoAbono getTipoAbono() {
        return tipoAbono;
    }

    public void setTipoAbono(TipoAbono tipoAbono) {
        this.tipoAbono = tipoAbono;
    }

    public GenericEnumType getEstatusActivo() {
        return estatusActivo;
    }

    public void setEstatusActivo(GenericEnumType estatusActivo) {
        this.estatusActivo = estatusActivo;
    }

    public GenericEnumType getPagoEstatus() {
        return pagoEstatus;
    }

    public void setPagoEstatus(GenericEnumType pagoEstatus) {
        this.pagoEstatus = pagoEstatus;
    }

    public Date getFechaAPagar() {
        return fechaAPagar;
    }

    public void setFechaAPagar(Date fechaAPagar) {
        this.fechaAPagar = fechaAPagar;
    }

    public Double getPago() {
        return pago;
    }

    public void setPago(Double pago) {
        this.pago = pago;
    }

    public Double getSaldoAnterior() {
        return saldoAnterior;
    }

    public void setSaldoAnterior(Double saldoAnterior) {
        this.saldoAnterior = saldoAnterior;
    }

    public Double getSaldoNuevo() {
        return saldoNuevo;
    }

    public void setSaldoNuevo(Double saldoNuevo) {
        this.saldoNuevo = saldoNuevo;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    public User getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(User lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public void setFechaAPagar(Calendar fecha) {
        throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
    }

    public Double getCantidadPagada() {
        return cantidadPagada;
    }

    public void setCantidadPagada(Double cantidadPagada) {
        this.cantidadPagada = cantidadPagada;
    }

    public Double getMandadoPagado() {
        return mandadoPagado;
    }

    public void setMandadoPagado(Double mandadoPagado) {
        this.mandadoPagado = mandadoPagado;
    }

    public Double getMandadoPagar() {
        return mandadoPagar;
    }

    public void setMandadoPagar(Double mandadoPagar) {
        this.mandadoPagar = mandadoPagar;
    }

    public Double getCobranzaPagada() {
        return cobranzaPagada;
    }

    public void setCobranzaPagada(Double cobranzaPagada) {
        this.cobranzaPagada = cobranzaPagada;
    }

    public Double getCobranzaPagar() {
        return cobranzaPagar;
    }

    public void setCobranzaPagar(Double cobranzaPagar) {
        this.cobranzaPagar = cobranzaPagar;
    }

    public String getNumeroAbono() {
        return numeroAbono;
    }

    public void setNumeroAbono(String numeroAbono) {
        this.numeroAbono = numeroAbono;
    }

    public Double getDiferenciaPago() {
        return diferenciaPago;
    }

    public void setDiferenciaPago(Double diferenciaPago) {
        this.diferenciaPago = diferenciaPago;
    }

    public int getConvenio() {
        return convenio;
    }

    public void setConvenio(int convenio) {
        this.convenio = convenio;
    }

    public int getPagoJuridico() {
        return pagoJuridico;
    }

    public void setPagoJuridico(int pagoJuridico) {
        this.pagoJuridico = pagoJuridico;
    }

    public Double getPagoExtra() {
        return pagoExtra;
    }

    public void setPagoExtra(Double pagoExtra) {
        this.pagoExtra = pagoExtra;
    }

    public Date getFechaPagoExtra() {
        return fechaPagoExtra;
    }

    public void setFechaPagoExtra(Date fechaPagoExtra) {
        this.fechaPagoExtra = fechaPagoExtra;
    }

    public User getUserPagoExtra() {
        return userPagoExtra;
    }

    public void setUserPagoExtra(User userPagoExtra) {
        this.userPagoExtra = userPagoExtra;
    }

    public String getFolio() {
        return folio;
    }

    public void setFolio(String folio) {
        this.folio = folio;
    }

    public HitorialAbonoMultiple getAbonoMultiple() {
        return abonoMultiple;
    }

    public void setAbonoMultiple(HitorialAbonoMultiple abonoMultiple) {
        this.abonoMultiple = abonoMultiple;
    }

}
