import '../enums/vehicle_command_type.dart';

// AI Chat Command States
enum AIChatCommandStatus {
  idle,
  executing,
  success,
  failure,
  cancelled,
}

class AIChatCommandState {
  final String? commandId;
  final VehicleCommandType? commandType;
  final Map<String, dynamic>? params;
  final AIChatCommandStatus status;
  final String? errorMessage;
  final Map<String, dynamic>? result;
  final DateTime? timestamp;

  const AIChatCommandState({
    this.commandId,
    this.commandType,
    this.params,
    this.status = AIChatCommandStatus.idle,
    this.errorMessage,
    this.result,
    this.timestamp,
  });

  AIChatCommandState copyWith({
    String? commandId,
    VehicleCommandType? commandType,
    Map<String, dynamic>? params,
    AIChatCommandStatus? status,
    String? errorMessage,
    Map<String, dynamic>? result,
    DateTime? timestamp,
  }) {
    return AIChatCommandState(
      commandId: commandId ?? this.commandId,
      commandType: commandType ?? this.commandType,
      params: params ?? this.params,
      status: status ?? this.status,
      errorMessage: errorMessage ?? this.errorMessage,
      result: result ?? this.result,
      timestamp: timestamp ?? this.timestamp,
    );
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is AIChatCommandState &&
        other.commandId == commandId &&
        other.commandType == commandType &&
        other.status == status &&
        other.errorMessage == errorMessage;
  }

  @override
  int get hashCode {
    return commandId.hashCode ^
    commandType.hashCode ^
    status.hashCode ^
    errorMessage.hashCode;
  }
}