package com.gh.gamecenter.qa.answer.detail;

import static com.gh.gamecenter.common.constant.Constants.GAME_DETAIL_COME_IN;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;

import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.entity.SpecialColumn;
import com.halo.assistant.HaloApp;

/**
 * Created by khy on 10/04/18.
 */

public class AnswerDetailActivity extends ToolBarActivity {
    public static final String TAG = "AnswerDetailActivity";

    @Override
    public boolean showToolbarAtLeft() {
        if (HaloApp.get(GAME_DETAIL_COME_IN, false) != null) {
            return true;
        }
        return super.showToolbarAtLeft();
    }

    @NonNull
    public static Intent getIntent(Context context, String answerId, String entrance, String path) {
        return getIntent(context, answerId, entrance, path, false, null);
    }

    @NonNull
    public static Intent getIntent(Context context, String answerId, String entrance, String path, boolean isOpenCommentManager) {
        return getIntent(context, answerId, entrance, path, isOpenCommentManager, null);
    }

    @NonNull
    public static Intent getIntent(Context context, String answerId, String entrance, String path, SpecialColumn specialColumn) {
        return getIntent(context, answerId, entrance, path, false, specialColumn);
    }

    @NonNull
    public static Intent getIntent(Context context, String answerId, String entrance, String path, boolean isOpenCommentManager, SpecialColumn specialColumn) {
        Bundle bundle = new Bundle();
        bundle.putString(EntranceConsts.KEY_ANSWER_ID, answerId);
        bundle.putString(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path));
        bundle.putBoolean(EntranceConsts.KEY_SHOW_ANSWER_COMMENT, isOpenCommentManager);
        bundle.putString(EntranceConsts.KEY_PATH, path);
        bundle.putParcelable(EntranceConsts.KEY_DATA, specialColumn);
        return getTargetIntent(context, AnswerDetailActivity.class, AnswerDetailContainerFragment.class, bundle);
    }

    @NonNull
    public static Intent getRecommendsIntent(Context context, String answerId, String entrance, String path) {
        Bundle bundle = new Bundle();
        bundle.putString(EntranceConsts.KEY_ANSWER_ID, answerId);
        bundle.putString(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path));
        bundle.putBoolean(EntranceConsts.KEY_RECOMMENDS_CONTENTS, true);
        bundle.putString(EntranceConsts.KEY_PATH, path);
        return getTargetIntent(context, AnswerDetailActivity.class, AnswerDetailContainerFragment.class, bundle);
    }

    @Override
    protected Intent provideNormalIntent() {
        return getTargetIntent(this, AnswerDetailActivity.class, AnswerDetailContainerFragment.class);
    }
}
