#pragma once

#include <stdint.h>

#include <memory>
#include <list>
#include <vector>
#include <string>

#include <QString>

#include "data/pattern.h"

namespace Xybrid {
    class UISocket;
}

namespace Xybrid::Data {
    class Graph;
    class Project {
    public:
        bool editingLocked();

        UISocket* socket;

        std::string title;
        std::string artist;

        QString fileName;

        float tempo = 140.0;
        TimeSignature time;
        // default time signature

        // shared to ease reordering and prevent crashes due to invalidating things that UI stuff is using
        std::vector<std::shared_ptr<Pattern>> patterns;
        std::vector<Pattern*> sequence; // nullptr as separator

        std::shared_ptr<Graph> rootGraph;
        // list of input nodes is just part of rootGraph

        Project();
        ~Project();

        void updatePatternIndices();

        std::shared_ptr<Pattern> newPattern(size_t index = static_cast<size_t>(-1));

        void removePattern(Pattern*);
    };
}
