datasynth_core/models/
financial_statements.rs1use chrono::NaiveDate;
4use rust_decimal::Decimal;
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
9#[serde(rename_all = "snake_case")]
10pub enum StatementType {
11 BalanceSheet,
13 IncomeStatement,
15 CashFlowStatement,
17 ChangesInEquity,
19}
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
23#[serde(rename_all = "snake_case")]
24pub enum StatementBasis {
25 #[default]
27 UsGaap,
28 Ifrs,
30 Statutory,
32}
33
34#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
36#[serde(rename_all = "snake_case")]
37pub enum CashFlowCategory {
38 Operating,
40 Investing,
42 Financing,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct FinancialStatementLineItem {
49 pub line_code: String,
51 pub label: String,
53 pub section: String,
55 pub sort_order: u32,
57 #[serde(with = "rust_decimal::serde::str")]
59 pub amount: Decimal,
60 #[serde(default, skip_serializing_if = "Option::is_none")]
62 pub amount_prior: Option<Decimal>,
63 pub indent_level: u8,
65 pub is_total: bool,
67 pub gl_accounts: Vec<String>,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct CashFlowItem {
74 pub item_code: String,
76 pub label: String,
78 pub category: CashFlowCategory,
80 #[serde(with = "rust_decimal::serde::str")]
82 pub amount: Decimal,
83 #[serde(default, skip_serializing_if = "Option::is_none")]
85 pub amount_prior: Option<Decimal>,
86 pub sort_order: u32,
88 pub is_total: bool,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94pub struct FinancialStatement {
95 pub statement_id: String,
97 pub company_code: String,
99 pub statement_type: StatementType,
101 pub basis: StatementBasis,
103 pub period_start: NaiveDate,
105 pub period_end: NaiveDate,
107 pub fiscal_year: u16,
109 pub fiscal_period: u8,
111 pub line_items: Vec<FinancialStatementLineItem>,
113 pub cash_flow_items: Vec<CashFlowItem>,
115 pub currency: String,
117 pub is_consolidated: bool,
119 pub preparer_id: String,
121}