module transaction.model;

import handy_http_primitives : Optional;
import std.datetime;

import util.money;

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

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

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

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