use rust_decimal::prelude::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct AmortizationPeriod {
pub period: u32,
pub principal_payment: Decimal,
pub interest_payment: Decimal,
pub remaining_balance: Decimal,
}
impl AmortizationPeriod {
pub fn new(period: u32, principal_payment: Decimal, interest_payment: Decimal, remaining_balance: Decimal) -> Self {
Self {
period,
principal_payment,
interest_payment,
remaining_balance,
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct DepreciationPeriod {
pub period: u32,
pub depreciation_expense: Decimal,
pub remaining_book_value: Decimal,
}
impl DepreciationPeriod {
pub fn new(period: u32, depreciation_expense: Decimal, remaining_book_value: Decimal) -> Self {
Self {
period,
depreciation_expense,
remaining_book_value,
}
}
}