firefly-iii 0.3.0

Rust API client for firefly-iii
Documentation
/*
 * Firefly III API v6.4.14
 *
 * 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>
 *
 * The version of the OpenAPI document: v6.4.14
 * Contact: james@firefly-iii.org
 * Generated by: https://openapi-generator.tech
 */

#![allow(unused_imports)]

use crate::models::{self, *};
use std::fmt;

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct AccountStore {
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "type")]
    pub r#type: models::ShortAccountTypeProperty,
    #[serde(rename = "iban", skip_serializing_if = "Option::is_none")]
    pub iban: Option<String>,
    #[serde(rename = "bic", skip_serializing_if = "Option::is_none")]
    pub bic: Option<String>,
    #[serde(rename = "account_number", skip_serializing_if = "Option::is_none")]
    pub account_number: Option<String>,
    /// Represents the opening balance, the initial amount this account holds.
    #[serde(rename = "opening_balance", skip_serializing_if = "Option::is_none")]
    pub opening_balance: Option<String>,
    /// Represents the date of the opening balance.
    #[serde(
        rename = "opening_balance_date",
        skip_serializing_if = "Option::is_none"
    )]
    pub opening_balance_date: Option<String>,
    #[serde(rename = "virtual_balance", skip_serializing_if = "Option::is_none")]
    pub virtual_balance: Option<String>,
    /// Use either currency_id or currency_code. Defaults to the user's financial administration's currency.
    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
    pub currency_id: Option<String>,
    /// Use either currency_id or currency_code. Defaults to the user's financial administration's currency.
    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
    pub currency_code: Option<String>,
    /// If omitted, defaults to true.
    #[serde(rename = "active", skip_serializing_if = "Option::is_none")]
    pub active: Option<bool>,
    /// Order of the account
    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
    pub order: Option<i32>,
    /// If omitted, defaults to true.
    #[serde(rename = "include_net_worth", skip_serializing_if = "Option::is_none")]
    pub include_net_worth: Option<bool>,
    #[serde(rename = "account_role", skip_serializing_if = "Option::is_none")]
    pub account_role: Option<models::AccountRoleProperty>,
    #[serde(rename = "credit_card_type", skip_serializing_if = "Option::is_none")]
    pub credit_card_type: Option<models::CreditCardTypeProperty>,
    /// Mandatory when the account_role is ccAsset. Moment at which CC payment installments are asked for by the bank.
    #[serde(
        rename = "monthly_payment_date",
        skip_serializing_if = "Option::is_none"
    )]
    pub monthly_payment_date: Option<String>,
    #[serde(rename = "liability_type", skip_serializing_if = "Option::is_none")]
    pub liability_type: Option<models::LiabilityTypeProperty>,
    #[serde(
        rename = "liability_direction",
        skip_serializing_if = "Option::is_none"
    )]
    pub liability_direction: Option<models::LiabilityDirectionProperty>,
    /// Mandatory when type is liability. Interest percentage.
    #[serde(rename = "interest", skip_serializing_if = "Option::is_none")]
    pub interest: Option<String>,
    #[serde(rename = "interest_period", skip_serializing_if = "Option::is_none")]
    pub interest_period: Option<models::InterestPeriodProperty>,
    #[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
    pub notes: Option<String>,
    /// Latitude of the accounts's location, if applicable. Can be used to draw a map.
    #[serde(rename = "latitude", skip_serializing_if = "Option::is_none")]
    pub latitude: Option<f64>,
    /// Latitude of the accounts's location, if applicable. Can be used to draw a map.
    #[serde(rename = "longitude", skip_serializing_if = "Option::is_none")]
    pub longitude: Option<f64>,
    /// Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels.
    #[serde(rename = "zoom_level", skip_serializing_if = "Option::is_none")]
    pub zoom_level: Option<i32>,
}

impl AccountStore {
    pub fn new(name: String, r#type: models::ShortAccountTypeProperty) -> AccountStore {
        AccountStore {
            name,
            r#type,
            iban: None,
            bic: None,
            account_number: None,
            opening_balance: None,
            opening_balance_date: None,
            virtual_balance: None,
            currency_id: None,
            currency_code: None,
            active: None,
            order: None,
            include_net_worth: None,
            account_role: None,
            credit_card_type: None,
            monthly_payment_date: None,
            liability_type: None,
            liability_direction: None,
            interest: None,
            interest_period: None,
            notes: None,
            latitude: None,
            longitude: None,
            zoom_level: None,
        }
    }
}

impl fmt::Display for AccountStore {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match serde_json::to_string(self) {
            Ok(json) => write!(f, "{}", json),
            Err(_) => write!(f, "{{{{}}}}"),
        }
    }
}