#pragma once

#include "../../TradeCore/abstract_strategy.hh"
#include "../../3rdParty/opennn/opennn.h"
#include <vector>
#include <deque>
#include <memory>

namespace AI {
    class SMA;
}

/**
 * @brief The NetworkInfo struct
 */
struct NetworkInfo {
    QString file;
    QDate from;
    QDate to;
    QString currency;
    QString period;
    double threshold;
    bool buy;
    bool sell;
};

class ChartCandle;
class StatusDialog;

/**
 * @brief Strategy based on one hour trend prediction by neural network
 */
class AnnOneHour : public AbstractStrategy
{
public:
    AnnOneHour();
    DataRequest requestedData() override;
    bool tradeData(const TradeData& data) override;
    OrderVector makeDecision() override;
    void onClientDoubleClicked() override;
    void decisionStatus(const OrderVector& status) override;

private:
    void checkNetwork();

private:
    DataRequest dataRequest_;
    TradeData tradeData_;
    OrderVector decisionStatus_;
    bool dataValid_;
    std::deque<ChartCandle> buffer_;
    std::unique_ptr<OpenNN::NeuralNetwork> network_;
    double networkOutput_;
    std::unique_ptr<StatusDialog> dialog_;
    bool tradingTime_;
    std::vector<NetworkInfo> networkList_;
    NetworkInfo currentInfo_;
};
