/**
 * MenuUtils — UI menu helper for Node-RED editor.
 * Methods are split across focused modules under ./menu/ and mixed onto the prototype.
 */

const toggles = require('./menu/toggles');
const dataFetching = require('./menu/dataFetching');
const urlUtils = require('./menu/urlUtils');
const dropdownPopulation = require('./menu/dropdownPopulation');
const htmlGeneration = require('./menu/htmlGeneration');

class MenuUtils {
  constructor() {
    this.isCloud = false;
    this.configData = null;
  }
}

// Mix all method groups onto the prototype
const mixins = [toggles, dataFetching, urlUtils, dropdownPopulation, htmlGeneration];
for (const mixin of mixins) {
  for (const [name, fn] of Object.entries(mixin)) {
    if (typeof fn === 'function') {
      Object.defineProperty(MenuUtils.prototype, name, {
        value: fn,
        writable: true,
        configurable: true,
        enumerable: false,
      });
    }
  }
}

module.exports = MenuUtils;
