package cn.yyxx.commsdk.impl.channel;

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

import org.json.JSONObject;

import cn.yyxx.commsdk.base.entity.SdkChargeInfo;
import cn.yyxx.commsdk.base.entity.SdkOrderInfo;
import cn.yyxx.commsdk.base.entity.SdkRoleInfo;
import cn.yyxx.commsdk.base.entity.bean.InitBean;
import cn.yyxx.commsdk.base.internal.ICallback;
import cn.yyxx.commsdk.base.internal.IRequestCallback;
import cn.yyxx.commsdk.base.internal.feature.IApplication;
import cn.yyxx.commsdk.base.internal.feature.IFeature;
import cn.yyxx.commsdk.base.internal.feature.ILifeCycle;
import cn.yyxx.commsdk.base.internal.feature.IOrder;
import cn.yyxx.commsdk.base.utils.Logger;
import cn.yyxx.commsdk.platform.PlatformSdk;

/**
 * @author #Suyghur.
 * Created on 2021/12/26
 */
public class ChannelSdkYYXX implements IFeature, ILifeCycle, IOrder,IApplication {

    private Activity activity;

    @Override
    public void initialize(Activity activity, ICallback callback) {
        Logger.i("initialize");
        this.activity = activity;
        PlatformSdk.getInstance(activity).initialize(activity,callback);
    }

    @Override
    public void initializeSuccess() {

        PlatformSdk.getInstance(activity).initializeSuccess();

    }


    @Override
    public void setLogoutListener(Activity activity, ICallback callback) {
        Logger.i("setLogoutListener");
        PlatformSdk.getInstance(activity).setLogoutListener(activity,callback);
    }


    @Override
    public void login(Activity activity, InitBean initBean, ICallback callback) {
        PlatformSdk.getInstance(activity).login(activity,initBean,callback);
    }

    @Override
    public void logout() {
        PlatformSdk.getInstance(activity).logout();

    }



    @Override
    public boolean hasExitView(Activity activity) {
        return PlatformSdk.getInstance(activity).hasExitView(activity);
    }

    @Override
    public void openExitView(Activity activity, ICallback callback) {

        PlatformSdk.getInstance(activity).openExitView(activity,callback);

    }

    @Override
    public void uploadRoleInfo(Activity activity, String type, SdkRoleInfo roleInfo) {
        PlatformSdk.getInstance(activity).uploadRoleInfo(activity,type,roleInfo);
    }

    @Override
    public void reportGameEvent(String event, JSONObject message) {
        PlatformSdk.getInstance(activity).reportGameEvent(event,message);
    }

    @Override
    public void onDestroy(Activity activity) {
        PlatformSdk.getInstance(activity).onDestroy(activity);
    }

    @Override
    public void onCreate(Activity activity, Bundle savedInstanceState) {
        PlatformSdk.getInstance(activity).onCreate(activity,savedInstanceState);
    }

    @Override
    public void onStart(Activity activity) {
        PlatformSdk.getInstance(activity).onStart(activity);
    }

    @Override
    public void onResume(Activity activity) {
        PlatformSdk.getInstance(activity).onResume(activity);
    }

    @Override
    public void onReStart(Activity activity) {
        PlatformSdk.getInstance(activity).onReStart(activity);
    }

    @Override
    public void onPause(Activity activity) {
        PlatformSdk.getInstance(activity).onPause(activity);
    }

    @Override
    public void onStop(Activity activity) {
        PlatformSdk.getInstance(activity).onStop(activity);
    }

    @Override
    public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
        PlatformSdk.getInstance(activity).onActivityResult(activity,requestCode,resultCode,data);
    }

    @Override
    public void onNewIntent(Activity activity, Intent intent) {
        PlatformSdk.getInstance(activity).onNewIntent(activity,intent);
    }

    @Override
    public void onConfigurationChanged(Activity activity, Configuration newconfig) {
        PlatformSdk.getInstance(activity).onConfigurationChanged(activity,newconfig);
    }

    @Override
    public void onWindowFocusChanged(Activity activity, boolean hasFocus) {
        PlatformSdk.getInstance(activity).onWindowFocusChanged(activity,hasFocus);
    }

    @Override
    public void attachBaseContext(Application application, Context context) {
        PlatformSdk.getInstance(context).attachBaseContext(application,context);
    }

    @Override
    public void initApplication(Application application) {
        PlatformSdk.getInstance(application).initApplication(application);
    }

    @Override
    public void getOrderInfo(Activity activity, SdkChargeInfo sdkChargeInfo, IRequestCallback requestCallback) {

    }

    @Override
    public void charge(Activity activity, SdkOrderInfo sdkOrderInfo, ICallback callback) {
        PlatformSdk.getInstance(activity).charge(activity,sdkOrderInfo,callback);
    }

    @Override
    public String getChannelOrderExt() {
        return PlatformSdk.getInstance(activity).getChannelOrderExt();
    }
}
