#pragma once #include "Model/Items.hpp" #include "Model/TransactionsModel.hpp" #include #include #include #include #include class Project { public: ItemList Products; ItemList Factories; ItemList Customers; TransactionModel Database; private: tsl::array_map mWorkflows; std::filesystem::path mRootPath; std::string mRootPathString; std::string mName; public: /// Load the project from a directory containing the cplt_project.json file. Project(const std::filesystem::path& rootPath); /// Create a project with the given name in the given path. Note that the path should be a directory that will contain the project files once created. /// This function assumes the given directory will exist and is empty. Project(std::filesystem::path rootPath, std::string name); /// Path to a *directory* that contains the project file. const std::filesystem::path& GetPath() const; const std::string& GetPathString() const; std::filesystem::path GetDatabasesDirectory() const; std::filesystem::path GetItemsDirectory() const; std::filesystem::path GetWorkflowsDirectory() const; std::filesystem::path GetWorkflowPath(std::string_view name) const; const std::string& GetName() const; void SetName(std::string name); const decltype(mWorkflows)& GetWorkflows() const; std::unique_ptr LoadWorkflow(std::string_view name); std::unique_ptr CreateWorkflow(std::string_view name); bool RemoveWorkflow(std::string_view name); bool RenameWorkflow(std::string_view name, std::string_view newName); Json::Value Serialize(); void WriteToDisk(); };