package com.baijiayun.live.ui;

import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import com.baijiayun.livebase.models.LPJoinCodeEnterRoomModel;
import com.baijiayun.livebase.models.LPSignEnterRoomModel;

/**
 * 入口类
 * Created by Shubo on 2017/2/13.
 */
public class LiveSDKWithUI {

    private LiveSDKWithUI() {

    }

    public static void enterRoomWithOne2OneTemplate(@NonNull Context context, LPJoinCodeEnterRoomModel joinCodeEnterRoomModel) {
        enterRoom(context, joinCodeEnterRoomModel, 1);
    }

    public static void enterRoomWithOne2OneTemplate(@NonNull Context context, LPSignEnterRoomModel signEnterRoomModel) {
        enterRoom(context, signEnterRoomModel, 1);
    }

    public static void enterRoom(@NonNull Context context, LPJoinCodeEnterRoomModel joinCodeEnterRoomModel) {
        enterRoom(context, joinCodeEnterRoomModel, 2);
    }

    public static void enterRoom(@NonNull Context context, LPSignEnterRoomModel signEnterRoomModel) {
        enterRoom(context, signEnterRoomModel, 2);
    }

    /**
     * 参加码进房间
     * @param context
     * @param joinCodeEnterRoomModel
     * @param templateType
     */
    private static void enterRoom(@NonNull Context context, LPJoinCodeEnterRoomModel joinCodeEnterRoomModel, int templateType){
        Class clazz;
        if (templateType == 1) {
            clazz = LiveRoomSingleActivity.class;
        } else {
            clazz = LiveRoomTripleActivity.class;
        }
        Intent intent = new Intent(context, clazz);
        intent.putExtra("code", joinCodeEnterRoomModel);
        context.startActivity(intent);
    }

    /**
     * 签名进房间
     * @param context
     * @param signEnterRoomModel
     * @param templateType
     */
    private static void enterRoom(@NonNull Context context, LPSignEnterRoomModel signEnterRoomModel, int templateType){
        Class clazz;
        if (templateType == 1) {
            clazz = LiveRoomSingleActivity.class;
        } else {
            clazz = LiveRoomTripleActivity.class;
        }
        Intent intent = new Intent(context, clazz);
        intent.putExtra("sign", signEnterRoomModel);
        context.startActivity(intent);
    }

    public static void setShopFragment(Fragment shopFragment) {
        LiveRoomTripleActivity.setLiveShowShopFragment(shopFragment);
    }
}
