package com.mints.goodmoney.mvp.presenters;

import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;

import java.util.HashMap;

public class TrackPresenter extends BaseTrackPresenter {

    /**
     * 离线收益
     */
    public void offline() {
        AppHttpManager.getInstance(loanApplication)
                .call(loanService.offline(),
                        new BaseSubscriber<BaseResponse<Object>>() {
                            @Override
                            public void onCompleted() {
                            }

                            @Override
                            public void onError(Throwable e) {

                            }

                            @Override
                            public void onNext(BaseResponse<Object> baseResponse) {
                            }
                        });
    }

    /**
     * 广告事件
     * <p>
     * eventType-0 成功 1失败 2点击 3-有效展示
     */
    public void addCallImp(String adSource, String eventType, String errorcode, String errormsg) {
        HashMap<String, Object> vo = new HashMap<>();
        vo.put("adSource", adSource);
        vo.put("eventType", eventType);
        vo.put("errorCode", errorcode);
        vo.put("errorMsg", errormsg);

        AppHttpManager.getInstance(loanApplication)
                .call(loanService.addCallImp(vo),
                        new BaseSubscriber<BaseResponse<Object>>() {
                            @Override
                            public void onCompleted() {
                            }

                            @Override
                            public void onError(Throwable e) {

                            }

                            @Override
                            public void onNext(BaseResponse<Object> baseResponse) {
                            }
                        });
    }
}
