Giuliano Paschoalino 6b0a5d61d3 Refatoração e melhorias gerais no processamento de faturas
- Alterado namespace para `Download_Faturas.Tests` e adicionados cabeçalhos de copyright.
- Refatoração para uso de recursos modernos do C# (ex.: inicializações simplificadas, métodos estáticos).
- Adicionados comentários XML e arquivo `stylecop.json` para padronização.
- Melhorias em testes de integração, incluindo ajustes na lógica de comparação e manipulação de CSV.
- Refatoração das classes `Fatura` e `FaturaOld` para encapsulamento e redução de duplicação.
- Adicionado suporte a conversores JSON personalizados (`DefaultDateTimeConverter`, `FloatArrayOrSingleConverter`).
- Melhorias no arquivo `Program.cs` com novos métodos auxiliares e tratamento de erros.
- Adicionadas classes auxiliares para manipulação de PDFs (`PDFSplitter`, `CustomPdfSplitter`).
- Ajustes nos arquivos de projeto para geração de documentação XML e inclusão do `StyleCop.Analyzers`.
- Correções em valores de consumo e demanda nos arquivos CSV.
- Melhor tratamento de erros e mensagens de log para facilitar o diagnóstico.
2025-11-28 11:21:22 -03:00

334 lines
8.4 KiB
C#

// <copyright file="Rootobject.cs" company="Smart Energia">
// Copyright (c) Smart Energia. All rights reserved.
// </copyright>
namespace Download_Faturas
{
using System.Text.Json.Serialization;
#pragma warning disable CS8618, SA1300, SA1402
/// <summary>
/// Root object class representing the invoice JSON structure.
/// </summary>
public class Rootobject
{
/// <summary>
/// Gets or sets the version.
/// </summary>
public string version { get; set; }
/// <summary>
/// Gets or sets the MD5 hash.
/// </summary>
public string md5 { get; set; }
/// <summary>
/// Gets or sets the provider.
/// </summary>
public string provider { get; set; }
/// <summary>
/// Gets or sets the provider data.
/// </summary>
public Providerdata providerData { get; set; }
/// <summary>
/// Gets or sets the location number.
/// </summary>
public string locationNumber { get; set; }
/// <summary>
/// Gets or sets the subclass.
/// </summary>
public string subclass { get; set; }
/// <summary>
/// Gets or sets the subgroup.
/// </summary>
public string subgroup { get; set; }
/// <summary>
/// Gets or sets the customer.
/// </summary>
public Customer customer { get; set; }
/// <summary>
/// Gets or sets the losses.
/// </summary>
public float losses { get; set; }
/// <summary>
/// Gets or sets the total charges.
/// </summary>
public float totalCharges { get; set; }
/// <summary>
/// Gets or sets the tariff modality.
/// </summary>
public string tariffModality { get; set; }
/// <summary>
/// Gets or sets the dates.
/// </summary>
public Dates dates { get; set; }
/// <summary>
/// Gets or sets the measured items.
/// </summary>
public Measureditem[] measuredItems { get; set; }
/// <summary>
/// Gets or sets the items.
/// </summary>
public Item[] items { get; set; }
}
/// <summary>
/// Provider data class representing provider information.
/// </summary>
public class Providerdata
{
/// <summary>
/// Gets or sets the name.
/// </summary>
public Name name { get; set; }
/// <summary>
/// Gets or sets the CNPJ.
/// </summary>
public Cnpj cnpj { get; set; }
}
/// <summary>
/// Class representing the name information.
/// </summary>
public class Name
{
/// <summary>
/// Gets or sets the value.
/// </summary>
public string value { get; set; }
/// <summary>
/// Gets or sets the confidence.
/// </summary>
public string confidence { get; set; }
}
/// <summary>
/// Class representing the CNPJ information.
/// </summary>
public class Cnpj
{
/// <summary>
/// Gets or sets the value.
/// </summary>
public string value { get; set; }
/// <summary>
/// Gets or sets the confidence.
/// </summary>
public string confidence { get; set; }
}
/// <summary>
/// Customer class representing customer information.
/// </summary>
public class Customer
{
/// <summary>
/// Gets or sets the CNPJ.
/// </summary>
public string cnpj { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string name { get; set; }
/// <summary>
/// Gets or sets the address.
/// </summary>
public Address address { get; set; }
}
/// <summary>
/// Address class representing customer address information.
/// </summary>
public class Address
{
/// <summary>
/// Gets or sets the street and number.
/// </summary>
public string streetAndNumber { get; set; }
/// <summary>
/// Gets or sets the city.
/// </summary>
public string city { get; set; }
/// <summary>
/// Gets or sets the state.
/// </summary>
public string state { get; set; }
/// <summary>
/// Gets or sets the zip code.
/// </summary>
public string zipCode { get; set; }
/// <summary>
/// Gets or sets the district.
/// </summary>
public string district { get; set; }
}
/// <summary>
/// Dates class representing various date information.
/// </summary>
public class Dates
{
/// <summary>
/// Gets or sets the due date.
/// </summary>
public DateTime due { get; set; }
/// <summary>
/// Gets or sets the issue month.
/// </summary>
public DateTime month { get; set; }
/// <summary>
/// Gets or sets the reading information.
/// </summary>
public Reading reading { get; set; }
}
/// <summary>
/// Reading class representing reading period information.
/// </summary>
public class Reading
{
/// <summary>
/// Gets or sets the start of the reading period.
/// </summary>
[JsonConverter(typeof(DefaultDateTimeConverter))]
public DateTime periodFrom { get; set; }
/// <summary>
/// Gets or sets the end of the reading period.
/// </summary>
[JsonConverter(typeof(DefaultDateTimeConverter))]
public DateTime periodUntil { get; set; }
}
/// <summary>
/// Measured item class representing measured item information.
/// </summary>
public class Measureditem
{
/// <summary>
/// Gets or sets the type.
/// </summary>
public string type { get; set; }
/// <summary>
/// Gets or sets the kind.
/// </summary>
public string kind { get; set; }
/// <summary>
/// Gets or sets the period.
/// </summary>
public string period { get; set; }
/// <summary>
/// Gets or sets the texts.
/// </summary>
public string[] texts { get; set; }
/// <summary>
/// Gets or sets the measured values.
/// </summary>
[JsonConverter(typeof(FloatArrayOrSingleConverter))]
public float[] measured { get; set; }
}
/// <summary>
/// Item class representing invoice item information.
/// </summary>
public class Item
{
/// <summary>
/// Gets or sets the item type.
/// </summary>
public string type { get; set; }
/// <summary>
/// Gets or sets the kind.
/// </summary>
public string kind { get; set; }
/// <summary>
/// Gets or sets the period.
/// </summary>
public string period { get; set; }
/// <summary>
/// Gets or sets the billed amount.
/// </summary>
public float billed { get; set; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
public float? rate { get; set; }
/// <summary>
/// Gets or sets the charge.
/// </summary>
public float charge { get; set; }
/// <summary>
/// Gets or sets the TUSD rate.
/// </summary>
public float tusdRate { get; set; }
/// <summary>
/// Gets or sets the TE rate.
/// </summary>
public float teRate { get; set; }
/// <summary>
/// Gets or sets the texts.
/// </summary>
public string[] texts { get; set; }
/// <summary>
/// Gets or sets the basic rate.
/// </summary>
public float basicRate { get; set; }
/// <summary>
/// Gets or sets the contract.
/// </summary>
public float contract { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string name { get; set; }
/// <summary>
/// Gets or sets the taxable amount.
/// </summary>
public float? taxable { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the item is summable.
/// </summary>
public bool summable { get; set; }
}
#pragma warning restore CS8618, SA1300, SA1402
}