#ifndef _APP_CONNECT_HPP_ #define _APP_CONNECT_HPP_ #include class System; class Module; class Part; // 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 { // Outcome of connecting two parts. The side effects (filling identity NC pins, // creating the Connection and adding it to the system) all happen in core; the // caller only renders the fields. struct ConnectResult { bool ok = false; ///< a Connection was created and added bool refused = false; ///< a business rule rejected it (vs. an exception) std::string error; ///< why refused/failed; empty when ok std::string connection_name; std::string transform_name; int wires = 0; ///< pin_map size of the created connection // Identity-transform path only: the compatibility info line and how many NC // pins were materialised so both sides match. Empty / 0 otherwise. std::string identity_info; int nc_added = 0; }; // Wire part `p1` (in module `m1`) to part `p2` (in module `m2`): look up the // transform for their connector types, refuse on an unknown pairing or an // identity-incompatible layout, fill identity NC pins when needed, apply the // transform and create the Connection. Pure core — no resolution of names or // patterns (the frontend turns user input into the Module*/Part* it passes). ConnectResult connect_parts(System *sys, Module *m1, Part *p1, Module *m2, Part *p2); } // namespace app #endif // _APP_CONNECT_HPP_