import 'package:flutter/material.dart';
import 'package:elektronika/app/core/utils/utils.dart';
import 'package:elektronika/app/data/models/models.dart';

class SearchApi {
  static Future<ProductModel?> getSearchResult(Map<String, dynamic> params) async {
    final List<ProductModel> products = [];
    try {
      const String path = Constants.BASE_URL + 'products';
      final response = await HttpUtil().get(path: path, queryParameters: params);

      for (final source in response['data']) {
        debugPrint('source: $source');
        products.add(ProductModel.fromJson(source));
      }

      return null;
    } catch (e) {
      debugPrint('error getProducts: $e');
      return null;
    }
  }
}

class TempSearchResult {
  late int id;
}
