/**
 * Command Parser Interfaces
 *
 * Defines types for parsing chat commands across all platforms
 */

/**
 * Issue reference types
 */
export interface IssueReference {
  /**
   * Issue number
   */
  number: number;

  /**
   * Repository owner (optional for current repo)
   */
  owner?: string;

  /**
   * Repository name (optional for current repo)
   */
  repo?: string;

  /**
   * Full URL (if provided as URL)
   */
  url?: string;
}

/**
 * Supported command actions
 */
export enum CommandAction {
  FIX = "fix",
  STATUS = "status",
  CANCEL = "cancel",
  RETRY = "retry",
  VERBOSE = "verbose",
  QUIET = "quiet",
  HELP = "help",
}

/**
 * Parsed command result
 */
export interface ParsedCommand {
  /**
   * The action to perform
   */
  action: CommandAction;

  /**
   * Issue reference (for fix command)
   */
  issue?: IssueReference;

  /**
   * Job ID (for status, cancel, retry, verbose commands)
   */
  jobId?: string;

  /**
   * Raw arguments
   */
  rawArgs: string[];
}

/**
 * Command parse error
 */
export interface CommandParseError {
  /**
   * Error message
   */
  message: string;

  /**
   * Suggested help text
   */
  help?: string;
}

/**
 * Command parse result (success or error)
 */
export type CommandParseResult =
  | { success: true; command: ParsedCommand }
  | { success: false; error: CommandParseError };
