firefly_iii/models/
basic_summary_entry.rs

1/*
2 * Firefly III API v6.4.14
3 *
4 * This is the documentation of the Firefly III API. Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. <br><br> Please keep in mind that the demo site does **not** accept requests from `curl`, `colly`, `wget`, etc. You must use a browser or a tool like Insomnia to make your test requests. <br><br> To learn more about the idiosyncrasies of this API, please read about the API in the [Firefly III API documentation](https://docs.firefly-iii.org/references/firefly-iii/api/). <br><br> <small>This file was last generated on 2025-12-26 @ 15:17:41 (Europe/Amsterdam)</small>
5 *
6 * The version of the OpenAPI document: v6.4.14
7 * Contact: james@firefly-iii.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11#![allow(unused_imports)]
12
13use crate::models::{self, *};
14use std::fmt;
15
16#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
17pub struct BasicSummaryEntry {
18    /// This is a reference to the type of info shared, not influenced by translations or user preferences. The EUR value is a reference to the currency code. Possibilities are: balance-in-ABC, spent-in-ABC, earned-in-ABC, bills-paid-in-ABC, bills-unpaid-in-ABC, left-to-spend-in-ABC and net-worth-in-ABC.
19    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
20    pub key: Option<String>,
21    /// A translated title for the information shared.
22    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
23    pub title: Option<String>,
24    /// The amount as a float.
25    #[serde(rename = "monetary_value", skip_serializing_if = "Option::is_none")]
26    pub monetary_value: Option<f64>,
27    /// The currency ID of the associated currency.
28    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
29    pub currency_id: Option<String>,
30    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
31    pub currency_code: Option<String>,
32    #[serde(rename = "currency_symbol", skip_serializing_if = "Option::is_none")]
33    pub currency_symbol: Option<String>,
34    /// Number of decimals for the associated currency.
35    #[serde(
36        rename = "currency_decimal_places",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub currency_decimal_places: Option<i32>,
40    /// True if there are no available budgets available.
41    #[serde(
42        rename = "no_available_budgets",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub no_available_budgets: Option<bool>,
46    /// The amount formatted according to the users locale
47    #[serde(rename = "value_parsed", skip_serializing_if = "Option::is_none")]
48    pub value_parsed: Option<String>,
49    /// Reference to a font-awesome icon without the fa- part.
50    #[serde(rename = "local_icon", skip_serializing_if = "Option::is_none")]
51    pub local_icon: Option<String>,
52    /// A short explanation of the amounts origin. Already formatted according to the locale of the user or translated, if relevant.
53    #[serde(rename = "sub_title", skip_serializing_if = "Option::is_none")]
54    pub sub_title: Option<String>,
55}
56
57impl BasicSummaryEntry {
58    pub fn new() -> BasicSummaryEntry {
59        BasicSummaryEntry {
60            key: None,
61            title: None,
62            monetary_value: None,
63            currency_id: None,
64            currency_code: None,
65            currency_symbol: None,
66            currency_decimal_places: None,
67            no_available_budgets: None,
68            value_parsed: None,
69            local_icon: None,
70            sub_title: None,
71        }
72    }
73}
74
75impl fmt::Display for BasicSummaryEntry {
76    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
77        match serde_json::to_string(self) {
78            Ok(json) => write!(f, "{}", json),
79            Err(_) => write!(f, "{{{{}}}}"),
80        }
81    }
82}