
import '../../local_peference/local_preference.dart';
import '../../network_api_service/api_service/api_service.dart';
import '../../network_api_service/api_urls/api_urls.dart';
import '../models/profile_model.dart';

class ProfileRepository {
  final ApiService _apiService = ApiService();

  Future<UserDetails> fetchUserDetails() async {
    try {
      final userId = await LocalPreference.getUserId();
      final response = await _apiService.get(
        '${ApiUrls.authUserDetails}/$userId',
      );
      return UserDetails.fromJson(response.data);
    } catch (e) {
      throw Exception('Failed to fetch user details: $e');
    }
  }
}
