/**
 * Command Processing Errors
 *
 * Custom error classes for expected business logic errors in command processing.
 * These errors should be caught and returned as error responses.
 * All other errors (system errors like OOM, DB failures) should propagate.
 */

/**
 * Base class for command processing errors that should be caught
 * and converted to error responses
 */
export class CommandProcessingError extends Error {
  constructor(message: string) {
    super(message);
    this.name = "CommandProcessingError";
    Error.captureStackTrace(this, this.constructor);
  }
}

/**
 * Error thrown when an unknown or unsupported command type is received
 */
export class UnknownCommandTypeError extends CommandProcessingError {
  constructor(commandType: string) {
    super(`Unknown command type: ${commandType}`);
    this.name = "UnknownCommandTypeError";
  }
}

/**
 * Error thrown when command payload validation fails
 */
export class InvalidCommandPayloadError extends CommandProcessingError {
  constructor(message: string) {
    super(message);
    this.name = "InvalidCommandPayloadError";
  }
}

/**
 * Error thrown when agent command execution fails due to business logic
 */
export class AgentCommandError extends CommandProcessingError {
  constructor(message: string) {
    super(message);
    this.name = "AgentCommandError";
  }
}
