module transaction.model;

import handy_http_primitives : Optional;
import std.datetime;

import util.money;

struct TransactionVendor {
    ulong id;
    string name;
    string description;
}

struct TransactionCategory {
    ulong id;
    Optional!ulong parentId;
    string name;
    string description;
    string color;
}

struct Transaction {
    ulong id;
    /// The time at which the transaction happened.
    SysTime timestamp;
    /// The time at which the transaction entity was saved.
    SysTime addedAt;
    ulong amount;
    Currency currency;
    string description;
    Optional!ulong vendorId;
    Optional!ulong categoryId;
}

struct TransactionLineItem {
    ulong transactionId;
    uint idx;
    long valuePerItem;
    ulong quantity;
    string description;
    Optional!ulong categoryId;
}
