import 'dart:async';

import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart';
import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/member_login_list_model.dart';

import 'package:mohem_flutter_app/api/api_client.dart';

class EITApiClient {
  static final EITApiClient _instance = EITApiClient._internal();

  EITApiClient._internal();

  factory EITApiClient() => _instance;

  Future<List<CollectionTransaction>?> getEITTransactions(String functionName) async {
    String url = "${ApiConsts.erpRest}GET_EIT_TRANSACTIONS";
    Map<String, dynamic> postParams = {'P_FUNCTION_NAME': functionName, "P_MENU_TYPE": "E", "P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1};
    postParams.addAll(AppState().postParamsJson);
    return await ApiClient().postJsonForObject((json) {
      List<CollectionTransaction>? responseData = GetEitTransactionsModel.fromJson(json['GetEITTransactionList'][0]).collectionTransaction;
      return responseData;
    }, url, postParams);
  }
}
