#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED

#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include "image.h"
#include "settings.h"
#include "imageViewer.h"

class Project{
    Settings* settings;
    std::string filename;
    std::vector<Image> images;
    cv::Mat combined;
    cv::Mat processed;
    int retrmode;
    int cannythresh;
    std::vector< std::vector<cv::Point> > contours;
    std::vector<cv::Vec4i> hierarchy;
    std::map<int, int> coloring;
    std::string gcode;

    //image viewers:
    ImageViewer ivcombined;
    ImageViewer ivprocessed;
public:
    Project(Settings* _settings);
    Project(Settings* _settings, std::string _filename);
    std::vector<Image>* getImages();
    int getRetrMode();
    int getCannyThresh();
    std::map<int, int>* getColoring();
    std::string* getGcode();
    void setFileName(std::string _filename);
    void setRetrMode(int _retrmode);
    void setCannyThresh(int _cannythresh);

    //project operations
    bool newProj();
    void loadProj();
    void save();
    void close();

    //processing operations
    bool combine();
    bool process();
    bool printEdge(int n);

    //gcode operations
    bool generateGcode();
    bool exportGcode(std::string file);

    //print status
    unsigned long int printStatus;
    bool printStop;
};

#endif // PROJECT_H_INCLUDED
