package cn.yyxx.commsdk.impl.merge.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.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.IMsaDeviceCallback;
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.impl.merge.channel.oppo.ChannelBridgeImpl;

public class ChannelBridge implements IFeature, ILifeCycle, IApplication, IOrder {

    private ChannelBridgeImpl impl = null;

    public ChannelBridge(Context context) {
        if (null == impl) {
            impl = new ChannelBridgeImpl(context);
        }
    }




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

    @Override
    public void initApplication(Application application) {
        impl.initApplication(application);

    }

    @Override
    public void initialize(Activity activity, ICallback callback) {
        impl.initialize(activity,callback);
    }

    @Override
    public void initializeSuccess(Activity activity, int loginStatus) {
        impl.initializeSuccess(activity,loginStatus);
    }

    @Override
    public void setLogoutListener(Activity activity, ICallback callback) {
        impl.setLogoutListener(activity,callback);
    }

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

    @Override
    public void logout() {
        impl.logout();
    }



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

    @Override
    public void openExitView(Activity activity,ICallback callback) {
        impl.openExitView(activity,callback);
    }

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

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

    @Override
    public void initMsaDeviceIds(Context context, IMsaDeviceCallback iMsaDeviceCallback) {
        impl.initMsaDeviceIds(context,iMsaDeviceCallback);
    }

    @Override
    public String getChannelOcfg(Activity activity) {
        return null;
    }


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

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

    @Override
    public void onRestart(Activity activity) {
        impl.onRestart(activity);
    }

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

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

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

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

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

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

    @Override
    public void onDestroy(Activity activity) {
        impl.onDestroy(activity);

    }

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


    public void startPay(Activity activity, SdkOrderInfo sdkOrderInfo,ICallback callback) {
        impl.startPay(activity,sdkOrderInfo,callback);
    }

    public String getChannelOrderExt() {
        return  impl.getChannelOrderExt();
    }
}
