Skip to main content

nfe_parser/base/item/imposto/
cofins.rs

1//! COFINS - Contribuição para Financiamento da Seguridade Social
2
3use serde::{Deserialize, Serialize};
4
5/// Container para os grupos de COFINS
6#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
7pub struct CofinsContainer {
8    /// COFINS Alíquota - CST 01 e 02
9    #[serde(rename = "COFINSAliq")]
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub cofins_aliq: Option<CofinsAliq>,
12    /// COFINS Não Tributado - CST 04, 05, 06, 07, 08 e 09
13    #[serde(rename = "COFINSNT")]
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub cofins_nt: Option<CofinsNt>,
16    /// COFINS Outras Operações
17    #[serde(rename = "COFINSOutr")]
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub cofins_outr: Option<CofinsOutr>,
20}
21
22/// COFINS Alíquota - Tributação por alíquota
23#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
24pub struct CofinsAliq {
25    /// Código de Situação Tributária da COFINS
26    #[serde(rename = "$unflatten=CST")]
27    pub cst: String,
28    /// Valor da Base de Cálculo da COFINS
29    #[serde(rename = "$unflatten=vBC")]
30    pub valor_bc: f32,
31    /// Alíquota da COFINS (em percentual)
32    #[serde(rename = "$unflatten=pCOFINS")]
33    pub aliquota: f32,
34    /// Valor da COFINS
35    #[serde(rename = "$unflatten=vCOFINS")]
36    pub valor: f32,
37}
38
39/// COFINS Não Tributado
40#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
41pub struct CofinsNt {
42    /// Código de Situação Tributária da COFINS
43    #[serde(rename = "$unflatten=CST")]
44    pub cst: String,
45}
46
47/// COFINS Outras Operações
48#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
49pub struct CofinsOutr {
50    /// Código de Situação Tributária da COFINS
51    #[serde(rename = "$unflatten=CST")]
52    pub cst: String,
53    /// Valor da Base de Cálculo da COFINS
54    #[serde(rename = "$unflatten=vBC")]
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub valor_bc: Option<f32>,
57    /// Alíquota da COFINS (em percentual)
58    #[serde(rename = "$unflatten=pCOFINS")]
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub aliquota: Option<f32>,
61    /// Valor da COFINS
62    #[serde(rename = "$unflatten=vCOFINS")]
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub valor: Option<f32>,
65}