// OrderData.h

#pragma once

#include <memory>

#include <iostream>
using namespace std;

#include <onepiece/models/OnePieceEnum.h>

class OrderData {

public:
    OrderData() = default;
    virtual ~OrderData() {
        if (this->m_instrumentID) this->m_instrumentID.reset();
        if (this->m_exchangeID) this->m_exchangeID.reset();
        if (this->m_orderRef) this->m_orderRef.reset();
        if (this->m_exchangeInstrument) this->m_exchangeInstrument.reset();
    };

    inline double LimitPrice() { return this->m_limitPrice; }
    inline void setLimitPrice(const double limitPrice) { this->m_limitPrice = limitPrice; }

    inline const shared_ptr<string> InstrumentID() { return this->m_instrumentID; }
    inline void setInstrumentID(const shared_ptr<string> instrumentID) { this->m_instrumentID = instrumentID; }

    inline const shared_ptr<string> ExchangeID() { return this->m_exchangeID; }
    inline void setExchangeID(const shared_ptr<string> exchangeID) { this->m_exchangeID = exchangeID; }

    inline const shared_ptr<string> ExchangeInstrument() { return this->m_exchangeInstrument; }
    inline void setExchangeInstrument(const shared_ptr<string> exchangeInstrument) { this->m_exchangeInstrument = exchangeInstrument; }

    inline int Lots() { return this->m_lots; }
    inline void setLots(const int lots) { this->m_lots = lots; }

    inline OPDirection Direction() { return this->m_direction; }
    inline void setDirection(const OPDirection direction) { this->m_direction = direction; }

    inline OPOpenClose CombOffsetFlag() { return this->m_combOffsetFlag; }
    inline void setCombOffsetFlag(const OPOpenClose combOffsetFlag) { this->m_combOffsetFlag = combOffsetFlag; }

    inline const shared_ptr<string> OrderRef() { return this->m_orderRef; }
    inline void setOrderRef(shared_ptr<string> orderRef) { this->m_orderRef = orderRef; }

    inline OPOrderStatus OrderStatus() { return this->m_orderStatus; }
    inline void setOrderStatus(OPOrderStatus orderStatus) { this->m_orderStatus = orderStatus; }

private:
    double m_limitPrice;
    int m_lots;
    shared_ptr<string> m_instrumentID;
    shared_ptr<string> m_exchangeID;
    shared_ptr<string> m_exchangeInstrument;

    shared_ptr<string> m_orderRef;

    OPDirection m_direction;
    OPOpenClose m_combOffsetFlag;
    OPOrderStatus m_orderStatus;
};

using OrderUPtr = unique_ptr<OrderData>;
using OrderSPtr = shared_ptr<OrderData>;