#!/usr/bin/env node

import { program } from 'commander';
import { authCommand } from '../src/commands/auth.js';
import { whoamiCommand } from '../src/commands/whoami.js';
import { sendCommand } from '../src/commands/send.js';
import { sendImageCommand } from '../src/commands/send-image.js';
import { messagesCommand } from '../src/commands/messages.js';

program
  .name('textnow')
  .description('CLI for TextNow SMS messaging')
  .version('1.0.0');

program
  .command('auth')
  .description('Authenticate with TextNow using browser cookies')
  .action(authCommand);

program
  .command('whoami')
  .description('Show current user info (username and phone number)')
  .action(whoamiCommand);

program
  .command('send <phone> <message>')
  .description('Send an SMS message')
  .action(sendCommand);

program
  .command('send-image <phone> <imagePath>')
  .description('Send an image message')
  .option('-c, --caption <caption>', 'Optional caption for the image')
  .action(sendImageCommand);

program
  .command('messages')
  .description('List recent messages')
  .option('-l, --limit <number>', 'Number of messages to retrieve', '20')
  .action(messagesCommand);

program.parse();
