package com.yyrh.factory;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;

import com.dolin.zap.Zap;
import com.yyrh.constant.RoleInfo;
import com.yyrh.core.impl.login.LoginActivity;
import com.yyrh.core.internal.IImplCallback;
import com.yyrh.sdk.SDKEntry;
import com.yyrh.sdk.YyrhSdkManager;
import com.yyrh.sdk.callback.RealNameMsgCallback;
import com.yythird.base.ChannelSdkCallback;

import org.json.JSONObject;

import java.util.HashMap;

public class YyrhSdkOperation implements ISdkOperation {

    public YyrhSdkOperation() {
    }


    @Override
    public void login(Activity activity) {
        LoginActivity.start(activity, true, SdkManager.defaultManager().isLandscape, new IImplCallback() {
            @Override
            public void onResult(int code, String result) {
                if (code == 1) {
                    SdkManager.defaultManager().sdkCallback.onLoginSuccess(result);
                } else {
                    SdkManager.defaultManager().sdkCallback.onLoginError(result);
                }
            }
        });
    }

    @Override
    public void uploadRoleInfo(String type, Activity activity, RoleInfo roleInfo) {

    }

    @Override
    public void setSDKLogoutListener(Activity ac, ChannelSdkCallback sdkCallback) {

    }


    @Override
    public void pay(Activity activity, HashMap<String, Object> map) {
        YyrhSdkManager.defaultManager().yyrhPay(activity, map);
    }

    @Override
    public void exit(Activity activity) {
        YyrhSdkManager.defaultManager().yyrhExitGame(activity);
    }

    @Override
    public void logOut() {
        YyrhSdkManager.defaultManager().yyrhLogout();
    }

    @Override
    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback) {
        YyrhSdkManager.defaultManager().yyrhGetRealNameInfo(activity, realNameMsgCallback);
    }

    @Override
    public void reportAdEvent(String event, JSONObject json) {
        SDKEntry.getSdkInstance().adSdkCallback.onReportAdEvent(event, json);
    }

    @Override
    public void sdkOnStart(Activity activity) {

    }

    @Override
    public void sdkOnCreate(Activity activity, Bundle savedInstanceState) {

    }

    @Override
    public void sdkOnPause(Activity activity) {
    }

    @Override
    public void sdkOnResume(Activity activity) {
    }

    @Override
    public void sdkOnRestart(Activity activity) {

    }


    @Override
    public void sdkOnStop(Activity activity) {

    }

    @Override
    public void sdkOnDestroy(Activity activity) {
    }

    @Override
    public void onConfigurationChanged(Configuration newConfigs) {

    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

    }

    @Override
    public void sdkOnNewIntent(Activity acitivty, Intent intent) {

    }

    @Override
    public void onActivityResult(Activity ac, int requestCode, int resultCode, Intent data) {

    }

    @Override
    public void onWindowFocusChanged(Activity activity, boolean hasFocus) {

    }
}
