module account.data;

import handy_http_primitives : Optional;

import account.model;
import util.money;
import history.model;

import std.datetime : SysTime;

interface AccountRepository {
    Optional!Account findById(ulong id);
    bool existsById(ulong id);
    Account insert(AccountType type, string numberSuffix, string name, Currency currency, string description);
    void setArchived(ulong id, bool archived);
    Account update(ulong id, in Account newData);
    void deleteById(ulong id);
    Account[] findAll();
    AccountCreditCardProperties getCreditCardProperties(ulong id);
    void setCreditCardProperties(ulong id, in AccountCreditCardProperties props);
    History getHistory(ulong id);
}

interface AccountJournalEntryRepository {
    Optional!AccountJournalEntry findById(ulong id);
    AccountJournalEntry insert(
        SysTime timestamp,
        ulong accountId,
        ulong transactionId,
        ulong amount,
        AccountJournalEntryType type,
        Currency currency
    );
    void deleteById(ulong id);
}
