#pragma once
#include "db/TransactionInfo.h"
#include "rshb/GetLastDaysHistoryScript.h"

class TransactionDAO {
public:
    [[nodiscard]] static bool insertTransactionIfNotExists(const TransactionInfo &info);

    [[nodiscard]] static int insertTransaction(const TransactionInfo &info);

    [[nodiscard]] static bool deleteTransaction(int id);

    [[nodiscard]] static QList<TransactionInfo> getTransactions(int accountId);

    [[nodiscard]] static bool updateTransaction(const TransactionInfo &info);

    [[nodiscard]] static bool updateTransactionStatus(int id, TransactionStatus status);

    [[nodiscard]] static TransactionInfo getTransactionById(int id);

    [[nodiscard]] static QList<TransactionInfo> getTransactionsWithinHours(int accountId, int hours);

    [[nodiscard]] static bool updateTransaction(
        int id, TransactionStatus status,
        const QString &oldDesc,
        const QString &newDesc
    );

    [[nodiscard]] static bool updateExternalTransactionId(int id, int externalId);
};
