// src/commands/help.js
export async function handleHelp(bot, trigger) {
  const isGroup = trigger.message.roomType === 'group';

  let text = `### ServiceChannel Bot Help\n\n`;

  if (isGroup) {
    text += `- **/woSummary** — status of the workorder linked to this space\n`;
    text += `- **/woHistory** - History of AV issues.\n`;
    text += `- **/woAttachments** — download attachments for the workorder in this space\n`;
    text += `- **/avStatus** — AV device status for the store linked to this space\n`;
    text += `- **/woApprove** — (re)post proposal approval card for current WO (when WAITING FOR APPROVAL)\n`;
    text += `- **/confirmed** — confirm WO resolution (SC CONFIRMED if allowed, else note + ops)\n`;
    text += `- **/addNote** — add a note to this work order in ServiceChannel (include your text after the command)\n`;
    text += `- **/attach** or **/upload** — upload a photo or file to this work order in ServiceChannel (attach the file to your message; optional caption after the command)\n`;
    text += `- **/trackStatus** — refresh FedEx shipment tracking for this WO (auto-poll every 2h, 8am–6pm ET)\n`;
    text += `- **/trackTest** — one-off FedEx API lookup (not stored; for testing)\n`;
    text += `\nFedEx tracking numbers in SC notes (e.g. \`FEDEX 876239420601\`) are registered automatically. Delivered packages notify the ops space.\n`;
  } else {
    text += `- **/createWO** — create a new ServiceChannel work order (Adaptive Card form)\n`;
    text += `- **/woSummary <WO-number>** — status of any work order\n`;
    text += `- **/woHistory <store-number>** — History of AV issues.\n`;
    text += `- **/woAttachments <WO-number>** — download attachments for any work order\n`;
    text += `- **/avStatus <store-number>** — AV device status for any store\n`;
    text += `- **/woApprove <WO-number>** — post proposal approval card (manual)\n`;
    text += `- **/trackTest <tracking-number>** — one-off FedEx API lookup (not stored)\n`;
  }

  text += `\nType **/help** again in a 1:1 or group space for context-specific commands.`;

  await bot.say('markdown', text);
}