import 'package:clean/base/base_request.dart';
import 'package:clean/data/api/event_api.dart';
import 'package:clean/data/api/request/attr_push_request.dart';
import 'package:clean/data/api/request/event_push_request.dart';
import 'package:clean/utils/http_handler.dart';

class EventRepository {

  EventRepository._();

  Future<void> eventPush(
      int ft, List<Map<String, dynamic>> es, {Map<String, dynamic>? pr}) {
    return eventApi.eventPush(EventPushRequest(ft, es, pr)).then(HttpHandler.handle(true));
  }

  Future<void> attrPush(
      String clientId, String clientType, String resultJson) {
    return eventApi.attrPush(AttrPushRequest(resultJson, clientId, clientType)).then(HttpHandler.handle(true));
  }
}

final EventRepository eventRepository = EventRepository._();