/*
* 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 AutocompleteAccount {
#[serde(rename = "id")]
pub id: String,
/// Name of the account found by an auto-complete search.
#[serde(rename = "name")]
pub name: String,
/// Asset accounts and liabilities have a second field with the given date's account balance in the account currency or primary currency.
#[serde(rename = "name_with_balance")]
pub name_with_balance: String,
/// Is the bill active or not?
#[serde(rename = "active", skip_serializing_if = "Option::is_none")]
pub active: Option<bool>,
/// Account type of the account found by the auto-complete search.
#[serde(rename = "type")]
pub r#type: String,
/// ID for the currency used by this account. If the user prefers amounts converted to their primary currency, this primary currency is used instead.
#[serde(rename = "currency_id")]
pub currency_id: String,
/// Currency name for the currency used by this account. If the user prefers amounts converted to their primary currency, this primary currency is used instead.
#[serde(rename = "currency_name")]
pub currency_name: String,
/// Currency code for the currency used by this account. If the user prefers amounts converted to their primary currency, this primary currency is used instead.
#[serde(rename = "currency_code")]
pub currency_code: String,
/// Currency symbol for the currency used by this account. If the user prefers amounts converted to their primary currency, this primary currency is used instead.
#[serde(rename = "currency_symbol")]
pub currency_symbol: String,
/// Number of decimal places for the currency used by this account. If the user prefers amounts converted to their primary currency, this primary currency is used instead.
#[serde(rename = "currency_decimal_places")]
pub currency_decimal_places: i32,
/// ID for the currency used by this account. Even if \"convertToPrimary\" is on, the account currency ID is displayed here.
#[serde(
rename = "account_currency_id",
skip_serializing_if = "Option::is_none"
)]
pub account_currency_id: Option<String>,
/// Name for the currency used by this account. Even if \"convertToPrimary\" is on, the account currency name is displayed here.
#[serde(
rename = "account_currency_name",
skip_serializing_if = "Option::is_none"
)]
pub account_currency_name: Option<String>,
/// Code for the currency used by this account. Even if \"convertToPrimary\" is on, the account currency code is displayed here.
#[serde(
rename = "account_currency_code",
skip_serializing_if = "Option::is_none"
)]
pub account_currency_code: Option<String>,
/// Code for the currency used by this account. Even if \"convertToPrimary\" is on, the account currency code is displayed here.
#[serde(
rename = "account_currency_symbol",
skip_serializing_if = "Option::is_none"
)]
pub account_currency_symbol: Option<String>,
/// Number of decimal places for the currency used by this account. Even if \"convertToPrimary\" is on, the account currency code is displayed here.
#[serde(
rename = "account_currency_decimal_places",
skip_serializing_if = "Option::is_none"
)]
pub account_currency_decimal_places: Option<i32>,
}
impl AutocompleteAccount {
pub fn new(
id: String,
name: String,
name_with_balance: String,
r#type: String,
currency_id: String,
currency_name: String,
currency_code: String,
currency_symbol: String,
currency_decimal_places: i32,
) -> AutocompleteAccount {
AutocompleteAccount {
id,
name,
name_with_balance,
active: None,
r#type,
currency_id,
currency_name,
currency_code,
currency_symbol,
currency_decimal_places,
account_currency_id: None,
account_currency_name: None,
account_currency_code: None,
account_currency_symbol: None,
account_currency_decimal_places: None,
}
}
}
impl fmt::Display for AutocompleteAccount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match serde_json::to_string(self) {
Ok(json) => write!(f, "{}", json),
Err(_) => write!(f, "{{{{}}}}"),
}
}
}