import '../entities/chat_message.dart';
import '../entities/stream_event.dart';

abstract class ChatRepository {
  /// Sends a text message to the agent and returns a stream of events.
  Stream<StreamEvent> sendMessage({
    required String sessionId,
    required String message,
    List<Map<String, dynamic>>? attachments,
  });

  /// Sends a voice message (audio file path) and returns a stream of events.
  Stream<StreamEvent> sendVoiceMessage({
    required String sessionId,
    required String audioPath,
  });

  /// Retrieves the full message history for a given session.
  Future<List<ChatMessage>> getSessionHistory(String sessionId);

  /// Approves a pending command approval request.
  Future<void> approveCommand(String taskId);

  /// Rejects a pending command approval request with an optional reason.
  Future<void> rejectCommand(String taskId, {String? reason});

  /// Cancels an active agent task by taskId.
  Future<void> cancelTask(String taskId);

  /// Injects a message while agent is working, returns a stream of events for the new task.
  Stream<StreamEvent> injectMessage({
    required String taskId,
    required String message,
  });

  /// Subscribes to an already-running agent task's WS stream without
  /// re-submitting a prompt. Used after a voice message upload to receive
  /// the agent's streamed response.
  Stream<StreamEvent> subscribeExistingTask({
    required String sessionId,
    required String taskId,
  });

  /// Confirms a standing order draft proposed by the agent.
  Future<void> confirmStandingOrder(
    String sessionId,
    Map<String, dynamic> draft,
  );
}
