/*********************************************************************
/*********************************************************************
 *  Author  : Tino Weinkauf and Wiebke K�pp
 *  Init    : Monday, October 09, 2017 - 16:06:40
 *
 *  Project : KTH Inviwo Modules
 *
 *  License : Follows the Inviwo BSD license model
 *********************************************************************
 */

#pragma once

#include "temporaltreemapsmoduledefine.h"
#include "temporaltree.h"

#include <nlohmann/json.hpp>
using json = nlohmann::json;

/** \docpage{org.inviwo.TemporalTreeWriter, Tree Writer}
    ![](org.inviwo.TemporalTreeWriter.png?classIdentifier=org.inviwo.TemporalTreeWriter)

    Writes a tree to disk.

    ### Inports
      * __<Inport1>__ <description>.

    ### Outports
      * __<Outport1>__ <description>.

    ### Properties
      * __<Prop1>__ <description>.
      * __<Prop2>__ <description>
*/

/** \class TemporalTreeWriter
    \brief Writes a simple text file containing a tree structure.

    @author Tino Weinkauf and Wiebke K�pp
*/
class TemporalTreeWriter {
    // Friends
    // Types
public:
    // Construction / Deconstruction
public:
    TemporalTreeWriter();
    virtual ~TemporalTreeWriter() = default;

    // Methods
public:
    static json createJSON(std::shared_ptr<TemporalTree> tree, const bool bNTG,
                           const bool bNTGAddWeights, const bool bNTGAddOrder,
                           double nTGScaleWeights);
    /// Our main computation function
    void process();

    // Ports
public:
    /// Tree to be written to disk.
    std::shared_ptr<TemporalTree> portInTree;

    // Properties
public:
    /// Filename of the tree file.
    string propFilename;

    /// Whether to pretty-print the output
    bool propPrettyPrint;

    /// Wheter we can overwrite the output file
    bool propOverwrite;

    /// Whether to add the weights to the NTG output
    bool propNTGAddWeights;

    /// Whether to add the order to the NTG output
    bool propNTGAddOrder;

    /// Scale the weights for NTG output
    double propNTGScaleWeights;

    // Attributes
private:
};
