using System;
namespace MLL
{
public class ModeloBoletos
{
// ── CONSTRUTOR VAZIO ──────────────────────────────────────────────────
public ModeloBoletos()
{
ID_BOLETO = 0;
CODIGO = string.Empty;
NUMERO = string.Empty;
NOSSO_NUMERO = string.Empty;
CHAVE_BOLETO = string.Empty;
LINHA_DIGITAVEL = string.Empty;
EMITIDO = null;
VENCE = null;
DT_PAGAMENTO = null;
VALOR = 0m;
VL_PAGO = null;
VL_MULTA = null;
VL_DESCONTO = null;
STATUS = "ABERTO";
PG = false;
SACADO = string.Empty;
CONTA = string.Empty;
COD_CONTA = string.Empty;
ACEITE = false;
IMPRESSO = false;
IMPORTACAO = false;
ARQUIVO_NOME = string.Empty;
ARQUIVO_TIPO = string.Empty;
ARQUIVO_CAMINHO = string.Empty;
ARQUIVO_DADOS = null;
OBSERVACAO = string.Empty;
DT_CADASTRO = DateTime.Now;
DT_ALTERACAO = null;
ID_USUARIO = null;
}
// ── IDENTIFICAÇÃO ─────────────────────────────────────────────────────
public int ID_BOLETO { get; set; }
public string CODIGO { get; set; }
public string NUMERO { get; set; }
public string NOSSO_NUMERO { get; set; }
/// Chave única para baixa/integração bancária.
public string CHAVE_BOLETO { get; set; }
/// Código de barras / linha digitável (47 ou 48 dígitos).
public string LINHA_DIGITAVEL { get; set; }
// ── DATAS ─────────────────────────────────────────────────────────────
public DateTime? EMITIDO { get; set; }
public DateTime? VENCE { get; set; }
/// Data efetiva em que o boleto foi pago.
public DateTime? DT_PAGAMENTO { get; set; }
// ── VALORES ───────────────────────────────────────────────────────────
public decimal VALOR { get; set; }
/// Valor efetivamente pago (pode diferir de VALOR por multa/desconto).
public decimal? VL_PAGO { get; set; }
/// Multa por atraso aplicada no pagamento.
public decimal? VL_MULTA { get; set; }
/// Desconto concedido no pagamento.
public decimal? VL_DESCONTO { get; set; }
// ── STATUS ────────────────────────────────────────────────────────────
///
/// Status do boleto.
/// Valores: ABERTO | PAGO | VENCIDO | CANCELADO | BAIXADO
///
public string STATUS { get; set; }
// ── FLAGS ─────────────────────────────────────────────────────────────
public bool PG { get; set; }
public bool ACEITE { get; set; }
public bool IMPRESSO { get; set; }
public bool IMPORTACAO { get; set; }
// ── SACADO E CONTA ────────────────────────────────────────────────────
public string SACADO { get; set; }
public string CONTA { get; set; }
public string COD_CONTA { get; set; }
// ── ARQUIVO (XML / PDF) ───────────────────────────────────────────────
/// Nome original do arquivo anexado.
public string ARQUIVO_NOME { get; set; }
/// Tipo do arquivo: "XML" ou "PDF".
public string ARQUIVO_TIPO { get; set; }
/// Caminho completo do arquivo em disco.
public string ARQUIVO_CAMINHO { get; set; }
/// Conteúdo binário do arquivo (para armazenamento no banco).
public byte[]? ARQUIVO_DADOS { get; set; }
// ── OBSERVAÇÃO ────────────────────────────────────────────────────────
public string OBSERVACAO { get; set; }
// ── RASTREABILIDADE ───────────────────────────────────────────────────
public DateTime DT_CADASTRO { get; set; }
public DateTime? DT_ALTERACAO { get; set; }
public int? ID_USUARIO { get; set; }
// ── HELPERS ───────────────────────────────────────────────────────────
/// Retorna true se o boleto está vencido e ainda não foi pago.
public bool EstaVencido =>
!PG && VENCE.HasValue && VENCE.Value.Date < DateTime.Today;
/// Retorna true se há arquivo anexado (caminho ou binário).
public bool TemArquivo =>
!string.IsNullOrEmpty(ARQUIVO_CAMINHO) || ARQUIVO_DADOS != null;
/// Valor com multa e desconto aplicados.
public decimal ValorFinal =>
VALOR + (VL_MULTA ?? 0m) - (VL_DESCONTO ?? 0m);
}
}