/*
 * 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 br.com.ctecinf.model;


import br.com.ctecinf.orm.Model;
import br.com.ctecinf.orm.Table;
import br.com.ctecinf.orm.Column;
import java.sql.Types;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;

/**
 *
 * @author Cássio Conceição
 * @since 21/08/2019 17:06:02
 * @version 201908
 * @see http://ctecinf.com.br/
 */
@Table("parcela")
public class Parcela extends Model {

    @Column(name = "crediario_id", type = Types.INTEGER, isNotNull = true, label = "Crediário", join = Crediario.class)
    private Crediario crediario;

    @Column(name = "numero_parcela", type = Types.INTEGER, isNotNull = true, label = "Parcela", tableDisplay = true)
    private Integer numeroParcela;

    @Column(name = "data_vencimento", type = Types.DATE, isNotNull = true, label = "Dt. Vcto.", tableDisplay = true)
    private java.sql.Date dataVencimento;

    @Column(name = "valor", type = Types.DECIMAL, isNotNull = true, label = "Valor", tableDisplay = true)
    private java.math.BigDecimal valor;

    @Column(name = "data_pagamento", type = Types.DATE, label = "Dt. Pgto.", tableDisplay = true)
    private java.sql.Date dataPagamento;

    @Column(name = "valor_pago", type = Types.DECIMAL, label = "Valor Pg.", tableDisplay = true)
    private java.math.BigDecimal valorPago;

    public Crediario getCrediario() {
        return this.crediario;
    }

    public void setCrediario(Crediario crediario) {
        this.crediario = crediario;
    }

    public Integer getNumeroParcela() {
        return this.numeroParcela;
    }

    public void setNumeroParcela(Integer numeroParcela) {
        this.numeroParcela = numeroParcela;
    }

    public java.sql.Date getDataVencimento() {
        return this.dataVencimento;
    }

    public void setDataVencimento(java.sql.Date dataVencimento) {
        this.dataVencimento = dataVencimento;
    }

    public java.math.BigDecimal getValor() {
        return this.valor;
    }

    public void setValor(java.math.BigDecimal valor) {
        this.valor = valor;
    }

    public java.sql.Date getDataPagamento() {
        return this.dataPagamento;
    }

    public void setDataPagamento(java.sql.Date dataPagamento) {
        this.dataPagamento = dataPagamento;
    }

    public java.math.BigDecimal getValorPago() {
        return this.valorPago;
    }

    public void setValorPago(java.math.BigDecimal valorPago) {
        this.valorPago = valorPago;
    }

    @Override
    public String toString() {
        SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
        return df.format(dataVencimento) + " - " + nf.format(valor);
    }
}