package com.genlot.ninglottery.module.report;

import android.os.Bundle;

import com.genlot.nativesdk.sender.EventToken;
import com.genlot.nativesdk.sender.TCPSender;
import com.genlot.ninglottery.base.BasePresenter;
import com.genlot.ninglottery.toolkit.LogTool;

/**
 * @author ZhuYongKang
 * @description ReportPresenter
 * @date 2019/8/20
 */
public class ReportPresenter extends BasePresenter<IReportView> {

    public void t101412QueryTimeReport(int gameId, long sTime, long eTime) {
        getView().showLoading();
        TCPSender.t101412QueryDailyReport(EventToken.T_QUERY_DAILY_REPORT, 1, gameId,
                String.valueOf(sTime), String.valueOf(eTime), new TCPSender.SenderCallback() {
                    @Override
                    public void onSenderSuccess(Bundle bundle) {
                        getView().dismissLoading();
                        getView().onQuerySuccess(bundle);
                    }

                    @Override
                    public void onSenderFail(int tradingCode, String message) {
                        getView().dismissLoading();
                        getView().showToast(message);
                        LogTool.logE(message);
                    }
                });
    }

    public void t101401QueryIssueReport(int gameId, String sIssue, String eIssue) {
        getView().showLoading();
        TCPSender.t101401QueryIssueReport(EventToken.T_QUERY_ISSUE_REPORT, 1, gameId,
                sIssue, eIssue, new TCPSender.SenderCallback() {
                    @Override
                    public void onSenderSuccess(Bundle bundle) {
                        getView().dismissLoading();
                        getView().onQuerySuccess(bundle);
                    }

                    @Override
                    public void onSenderFail(int code, String message) {
                        getView().dismissLoading();
                        getView().showToast(message);
                        LogTool.logE(message);
                    }
                });
    }

    public void t101404QueryBankReport(String sTime, String eTime) {
        getView().showLoading();
        TCPSender.t101404QueryBankReport(EventToken.T_QUERY_BANK_REPORT, 1, sTime, eTime,
                new TCPSender.SenderCallback() {
            @Override
            public void onSenderSuccess(Bundle bundle) {
                getView().dismissLoading();
                getView().onQuerySuccess(bundle);
            }

            @Override
            public void onSenderFail(int code, String message) {
                getView().dismissLoading();
                getView().showToast(message);
                LogTool.logE(message);
            }
        });
    }

}
