#pragma once

#include "app_core/document_session.h"
#include "foundation/result.h"

#include <functional>
#include <memory>

class App;
class NodeDialogNewDoc;
class NodeDialogSave;

namespace pp::panopainter {

[[nodiscard]] pp::foundation::Status execute_legacy_close_request_decision(
    App& app,
    pp::app::CloseRequestDecision decision,
    bool& dialog_already_opened);

[[nodiscard]] pp::foundation::Status execute_legacy_document_save_decision(
    App& app,
    pp::app::DocumentSaveDecision decision);

[[nodiscard]] pp::foundation::Status execute_legacy_document_workflow_decision(
    App& app,
    pp::app::DocumentWorkflowDecision decision,
    std::function<void()> action);

[[nodiscard]] pp::foundation::Status execute_legacy_new_document_plan(
    App& app,
    const pp::app::NewDocumentPlan& plan,
    std::shared_ptr<NodeDialogNewDoc> dialog);

[[nodiscard]] pp::foundation::Status execute_legacy_document_file_save_plan(
    App& app,
    const pp::app::DocumentFileSavePlan& plan,
    std::shared_ptr<NodeDialogSave> dialog);

[[nodiscard]] pp::foundation::Status execute_legacy_document_version_save(
    App& app,
    const pp::app::DocumentVersionTarget& target);

void execute_legacy_document_save_before_cloud_upload(App& app);

} // namespace pp::panopainter
