use super::ids::AccountId; use super::path::MaterializedPath; #[derive(PartialEq, Clone)] pub enum AccountType { Asset, Liability, Equity, Revenue, Expense } #[derive(Clone)] pub struct Account { account_id: AccountId, pub account_type: AccountType, pub name: String, pub description: String, pub path: MaterializedPath } impl Account { pub(crate) fn from_parts(account_id: AccountId, account_type: AccountType, name: String, description: String, path: MaterializedPath) -> Self { Account { account_id, account_type, name, description, path } } pub fn id(&self) -> AccountId { self.account_id } } pub struct NewAccount { pub account_type: AccountType, pub name: String, pub description: String, pub parent: Option } impl NewAccount { fn new(account_type: AccountType, name: impl Into, description: impl Into, parent: Option) -> NewAccount { NewAccount { account_type, name: name.into(), description: description.into(), parent } } }