#pragma once
// shell/package/import_bank — the promptless import verb: one package becomes one NEW
// bank in the live session, completely or not at all. No prompts, no message boxes, no
// picker — it reports and the action skin (shell/actions/package_import_action) speaks.
// The ledger gate is the skin's, because it must refuse BEFORE a file is even chosen.

#include <string>

#include "core/package/import_plan.h"
#include "shell/package/import_landing.h"

namespace reasampler {

class ReaSamplerSession;

struct ImportBankResult {
    ImportOutcome outcome = ImportOutcome::Unreadable;
    package::PackageHeader header;      // TooNew names the writer's build from here

    std::string bankId;                 // the minted id — meaningful only when outcome == Landed
    std::string bankDisplayName;        // the bank actually created
    std::string seedBankName;           // what the package asked to be called
    bool bankNameAdjusted = false;

    int landedCount = 0;
    int collisionRenameCount = 0;  // renamed: the package's own name was already taken
    int sanitizeRenameCount = 0;   // renamed: not spelled the way this tool spells a bank file
    int collapsedCount = 0;

    std::string    failedEntryName;
    RollbackResult rollback;
};

// Lands `packageAbsPath` as a new bank in `session`, in ONE undo point, bumping the
// bank generation so live instances reload. Places no timeline item. On any failure
// nothing remains on disk and the book is untouched.
ImportBankResult importBankPackage(ReaSamplerSession& session,
                                   const std::string& packageAbsPath);

}  // namespace reasampler
