import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../../core/network/api_client.dart';

final helpChatServiceProvider = Provider<HelpChatService>((ref) {
  return HelpChatService(ref.read(apiClientProvider));
});

class HelpChatService {
  HelpChatService(this._dio);
  final Dio _dio;

  Future<String> ask(List<Map<String, String>> messages) async {
    final res = await _dio.post<Map<String, dynamic>>(
      '/chat/help',
      data: {'messages': messages},
    );
    return (res.data?['reply'] as String?) ?? '';
  }
}
