import '../enums/vehicle_command_type.dart';
import '../services/command_service.dart';
import 'easy_bloc.dart';
import 'command_state.dart';

class AIChatCommandCubit extends EasyCubit<AIChatCommandState> {
  AIChatCommandCubit() : super(const AIChatCommandState());

  // 重置状态
  void reset() {
    emit(const AIChatCommandState());
  }

  // 生成唯一命令ID
  String _generateCommandId() {
    return '${DateTime.now().millisecondsSinceEpoch}_${state.commandType?.name ?? 'unknown'}';
  }

  // 检查当前是否有命令在执行
  bool get isExecuting => state.status == AIChatCommandStatus.executing;

  // 获取当前命令ID
  String? get currentCommandId => state.commandId;
}