// GENERATED CODE - DO NOT MODIFY BY HAND

// **************************************************************************
// ServiceGenerator
// **************************************************************************

import 'dart:convert';

import 'dart:io';

import 'package:rxdart/rxdart.dart';

import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';

import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';

class ActivityReportApiImpl {
  factory ActivityReportApiImpl() => _sharedInstance();

  static ActivityReportApiImpl _instance;

  ActivityReportApiImpl._() {}

  static ActivityReportApiImpl _sharedInstance() {
    if (_instance == null) {
      _instance = ActivityReportApiImpl._();
    }
    return _instance;
  }

  Observable<ActivityReportEntity> getActivityReport(int id, int type) {
    return Observable.fromFuture(DioUtil().get('api/v1/survey_question/report',
        data: {'survey_record_id': id, 'template_id': type})).map((value) {
      if (value != null && value.statusCode == 200) {
        Map map = json.decode(value.toString());
        return ActivityReportEntity.fromJson(map);
      }
    });
  }
}
