package com.yyrh.factory;

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

import com.yyrh.constant.RoleInfo;
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 {

    private static YyrhSdkManager yyrhSdkManager = null;

    public YyrhSdkOperation(Context context){
        yyrhSdkManager = YyrhSdkManager.defaultManager(context);
    }


    @Override
    public void login(Activity activity) {
        yyrhSdkManager.yyrhLogin(activity);
    }

    @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.yyrhPay(activity,map);
    }

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

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

    @Override
    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback) {
        yyrhSdkManager.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) {
        yyrhSdkManager.onPause(activity);
    }

    @Override
    public void sdkOnResume(Activity activity) {
        yyrhSdkManager.onResume(activity);
    }

    @Override
    public void sdkOnRestart(Activity activity) {

    }

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

    }

    @Override
    public void sdkOnStop(Activity activity) {

    }

    @Override
    public void onConfigurationChanged(Configuration newConfigs) {

    }

    @Override
    public void sdkOnDestroy(Activity activity) {
        yyrhSdkManager.onDestroy(activity);
    }

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

    }

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

    }

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

    }
}
