Skip to main content

paft_fundamentals/
statements.rs

1//! Financial statements and calendar types under `paft_fundamentals::statements`.
2
3use serde::{Deserialize, Serialize};
4
5use chrono::{DateTime, NaiveDate, Utc};
6#[cfg(feature = "dataframe")]
7use df_derive_macros::ToDataFrame;
8use paft_domain::ReportingPeriod;
9use paft_money::Money;
10
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
13/// Income statement row.
14pub struct IncomeStatementRow {
15    /// Financial period with structured variants and extensible fallback.
16    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
17    pub period: ReportingPeriod,
18    /// Total revenue.
19    pub total_revenue: Option<Money>,
20    /// Gross profit.
21    pub gross_profit: Option<Money>,
22    /// Operating income.
23    pub operating_income: Option<Money>,
24    /// Net income.
25    pub net_income: Option<Money>,
26    /// Interest expense.
27    pub interest_expense: Option<Money>,
28    /// Income tax expense (provision for income taxes).
29    pub income_tax_expense: Option<Money>,
30    /// Depreciation and amortization recognized on the income statement.
31    pub depreciation_and_amortization: Option<Money>,
32}
33
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
36/// Balance sheet row.
37pub struct BalanceSheetRow {
38    /// Financial period with structured variants and extensible fallback.
39    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
40    pub period: ReportingPeriod,
41    /// Total assets.
42    pub total_assets: Option<Money>,
43    /// Total liabilities.
44    pub total_liabilities: Option<Money>,
45    /// Total equity.
46    pub total_equity: Option<Money>,
47    /// Cash and cash equivalents.
48    pub cash: Option<Money>,
49    /// Long-term debt.
50    pub long_term_debt: Option<Money>,
51    /// Shares outstanding.
52    pub shares_outstanding: Option<u64>,
53    /// Total current assets.
54    pub current_assets: Option<Money>,
55    /// Total current liabilities.
56    pub current_liabilities: Option<Money>,
57    /// Accounts receivable, net.
58    pub accounts_receivable: Option<Money>,
59    /// Inventory.
60    pub inventory: Option<Money>,
61    /// Accounts payable.
62    pub accounts_payable: Option<Money>,
63    /// Property, plant, and equipment, net of accumulated depreciation.
64    pub net_property_plant_equipment: Option<Money>,
65    /// Goodwill.
66    pub goodwill: Option<Money>,
67    /// Intangible assets excluding goodwill.
68    pub intangible_assets: Option<Money>,
69}
70
71#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
72#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
73/// Cashflow statement row.
74pub struct CashflowRow {
75    /// Financial period with structured variants and extensible fallback.
76    #[cfg_attr(feature = "dataframe", df_derive(as_string))]
77    pub period: ReportingPeriod,
78    /// Operating cashflow.
79    pub operating_cashflow: Option<Money>,
80    /// Capital expenditures.
81    pub capital_expenditures: Option<Money>,
82    /// Free cash flow.
83    pub free_cash_flow: Option<Money>,
84    /// Net income.
85    pub net_income: Option<Money>,
86    /// Depreciation and amortization added back to net income.
87    pub depreciation_and_amortization: Option<Money>,
88}
89
90#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
91#[cfg_attr(feature = "dataframe", derive(ToDataFrame))]
92/// Corporate calendar entries (earnings/dividends).
93pub struct Calendar {
94    /// Upcoming or historical earnings dates.
95    #[serde(with = "paft_core::serde_helpers::ts_milliseconds_vec")]
96    pub earnings_dates: Vec<DateTime<Utc>>,
97    /// Ex-dividend calendar date.
98    #[serde(default)]
99    pub ex_dividend_date: Option<NaiveDate>,
100    /// Dividend payment calendar date.
101    #[serde(default)]
102    pub dividend_payment_date: Option<NaiveDate>,
103}