package com.genlot.ninglottery.module.info.wininfo;

import android.os.Bundle;

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

import java.util.ArrayList;

/**
 * @author ZhuYongKang
 * @description 中奖信息
 * @date 2019/10/29
 */
public class WinInfoPresenter extends BasePresenter<IWinInfoView> {

    void queryWinInfo(int gameId, long issue) {
        getView().showLoading();
        TCPSender.t101451QueryStationWinInfo(EventToken.T_QUERY_STATION_WIN_INFO, 1, gameId, issue, new TCPSender.SenderCallback() {
            @Override
            public void onSenderSuccess(Bundle bundle) {
                getView().dismissLoading();
                ArrayList<WinInfo> winInfos = bundle.getParcelableArrayList(EventToken.EVENT_KEY_RESULT_OBJECT);
                LogTool.logD(winInfos.toString());
                getView().onQuerySuccess(winInfos);
            }

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

}
