#ifndef _APP_EXPORT_HPP_ #define _APP_EXPORT_HPP_ #include class System; // Application layer: UI-independent operations that any frontend (TUI, GUI, …) // can call. No console, no dialogs, no FTXUI — just System in, result out. namespace app { enum class ExportFormat { Csv, Ods }; // Outcome of an export. The only side effect is writing the target file; the // caller renders `error` / the stats however it likes. struct ExportResult { bool ok = false; std::string error; ///< human-readable, set when !ok int sheets = 0; ///< ODS: number of sheets (one per connection); 0 for CSV int rows = 0; ///< wires written }; // Map a filename extension (.csv / .ods, case-insensitive) to a format. // Returns false if the extension is neither. bool export_format_from_path(const std::string &path, ExportFormat &out); // Export the system's connections to `path` in `format`. Builds the file and // returns stats or an error. Pure core — safe to call from any frontend. ExportResult export_connections(const System *sys, const std::string &path, ExportFormat format); } // namespace app #endif // _APP_EXPORT_HPP_