import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/services/model/feedback_response/feedback_response.dart';
import 'package:tm_app/data/services/model/tender_approvals_toggle_response/tender_approvals_toggle_response.dart';
import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart';
import 'package:tm_app/data/services/tenders_service.dart';

import '../services/model/tender_approvals_by_id_response/tender_approvals_by_id_response.dart';

class TendersRepository {
  TendersRepository({required TendersService tendersService})
    : _tendersService = tendersService;
  final TendersService _tendersService;

  Future<Result<TendersResponse>> getTenders({
    required int limit,
    required int offset,
    String? query,
    String? sortBy,
    String? sortOrder,
    String? publicationDateFrom,
    String? publicationDateTo,
  }) async {
    return _tendersService.getTenders(
      limit: limit,
      offset: offset,
      query: query,
      sortBy: sortBy,
      sortOrder: sortOrder,
      publicationDateFrom: publicationDateFrom,
      publicationDateTo: publicationDateTo,
    );
  }

  Future<Result<FeedbackResponse>> getTenderFeedback({
    required String tenderId,
  }) async {
    return _tendersService.getTenderFeedback(tenderId: tenderId);
  }

  Future<Result<FeedbackResponse>> toggleFeedback({
    required String tenderId,
    required String feedbackType,
  }) async {
    return _tendersService.toggleFeedback(
      tenderId: tenderId,
      feedbackType: feedbackType,
    );
  }

  Future<Result<TenderApprovalsToggleResponse>> toggleApprovals({
    required String tenderId,
    required String submissionMode,
    required String status,
  }) async {
    return _tendersService.toggleApprovals(
      tenderId: tenderId,
      submissionMode: submissionMode,
      status: status,
    );
  }

  Future<Result<TenderApprovalsByIdResponse>> getTenderApprovals({
    required String tenderId,
  }) async {
    return _tendersService.getTenderApprovalsById(tenderId: tenderId);
  }
}
