1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*!
 * Posting
 */

use crate::{
    amount::Amount,
    journal::{AccountIndex, XactIndex},
};

#[derive(Debug, PartialEq)]
pub struct Post {
    /// Pointer to the Account.
    // pub account: AccountIndex,
    pub account_index: AccountIndex,
    /// Pointer to the Xact.
    pub xact: XactIndex,

    pub amount: Option<Amount>,
    pub cost: Option<Amount>,
    // given_cost
    // assigned_amount
    // checkin
    // checkout
}

impl Post {
    /// Creates a Post from post tokens.
    pub fn new(
        account_index: AccountIndex,
        xact_index: XactIndex,
        amount: Option<Amount>,
        cost: Option<Amount>
    ) -> Self {
        Self {
            account_index,
            xact: xact_index,
            amount,
            cost,
        }
    }
}

#[cfg(test)]
mod tests {
}