// src/commands/index.js – FIXED: no hard-coded Framework

import { handleAvStatus } from './avStatus.js';
import { handleWoStatus }     from './woStatus.js';
import { handleAttachments }  from './attachments.js';
import { handleHelp }         from './help.js';
import { handleUnknown }      from './unknownCommand.js';

const PRIORITY = {
  DEVICE_STATUS: 3,
  WO_STATUS:     2,
  ATTACHMENTS:   3,
  HELP:          4,
  UNKNOWN:       99999,
};

export function registerAllCommands(framework) {
  // Less strict start anchor + allow optional space after command
  framework.hears(/woStatus/i, handleWoStatus, "**/woStatus** [WO#] - Work order status", 2);

  //framework.hears(/^\s*\/attachments\b/i, handleAttachments, "**/attachments** [WO#] - Attachments", 3);

  //framework.hears(/^\s*\/help\b/i, handleHelp, "**/help** - Show commands", 4);

  // Temporarily disable deviceStatus until we confirm others work
  //framework.hears(/^\s*\/deviceStatus\b/i, handleDeviceStatus, "**/deviceStatus** - Device status", 3);

  framework.hears(/.*/gim, handleUnknown, null, 99999);

  console.log("Commands registered with relaxed start regex.");
}