package com.datarecovery.master.module.member;

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

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.atmob.app.lib.base.BaseActivity;
import com.datarecovery.master.databinding.ActivityServiceDescriptionBinding;
import com.gyf.immersionbar.ImmersionBar;

import dagger.hilt.android.AndroidEntryPoint;

@AndroidEntryPoint
public class ServiceDescriptionActivity extends BaseActivity<ActivityServiceDescriptionBinding> {

    private static final String DESCRIPTION = "description";

    public static void start(Context context, String description) {
        Intent intent = new Intent(context, ServiceDescriptionActivity.class);
        if (!(context instanceof Activity)) {
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        intent.putExtra(DESCRIPTION, description);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initData();
    }

    @Override
    protected void configImmersion(@NonNull ImmersionBar immersionBar) {
        super.configImmersion(immersionBar);
        immersionBar.statusBarDarkFont(true);
    }

    private void initView() {
        addTopStatusBarHeight(binding.toolBar);
    }

    private void initData() {
        Intent intent = getIntent();
        if (intent != null) {
            binding.setDescription(intent.getStringExtra(DESCRIPTION));
        }
    }

    @Override
    protected boolean shouldImmersion() {
        return true;
    }
}
