import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/services/api/liked_tenders_api.dart';
import 'package:tm_app/data/services/model/liked_tenders_response/liked_tenders_response.dart';

import '../../../core/network/network_manager.dart';
import 'model/request_models/tender_feedback_request_model/tender_feedback_request_model.dart';

class LikedTendersService {
  LikedTendersService({required NetworkManager networkManager})
    : _networkManager = networkManager;

  final NetworkManager _networkManager;

  Future<Result<LikedTendersResponse>> getLikedTenders({
    required TenderFeedbackRequestModel requestModel,
  }) async {
    final uri = LikedTendersApi.getTendersFeedback(
      limit: requestModel.limit,
      offset: requestModel.offset,
      feedbackType: requestModel.feedbackType,
      dateFrom: requestModel.dateFrom,
      dateTo: requestModel.dateTo,
    );

    final result = await _networkManager.makeRequest(
      uri,
      (json) => LikedTendersResponse.fromJson(json),
      method: 'GET',
    );

    return result;
  }
}
