package com.datarecovery.master.module.feedback;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.atmob.app.lib.base.BaseViewModel;
import com.atmob.app.lib.livedata.SingleLiveEvent;
import com.datarecovery.master.R;
import com.datarecovery.master.data.consts.EventId;
import com.datarecovery.master.handler.EventHelper;
import com.datarecovery.master.utils.ToastUtil;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;


@HiltViewModel
public class UserFeedbackViewModel extends BaseViewModel {


    private final MutableLiveData<String> etContent = new MutableLiveData<>();

    private final SingleLiveEvent<?> finishEvent = new SingleLiveEvent<>();


    @Inject
    public UserFeedbackViewModel() {

    }

    public LiveData<?> getFinishEvent() {
        return finishEvent;
    }

    public MutableLiveData<String> getEtContent() {
        return etContent;
    }


    public void submitClick() {
        if (etContent.getValue() == null || etContent.getValue().isEmpty()) {
            ToastUtil.show(R.string.feedback_hint, ToastUtil.LENGTH_SHORT);
            return;
        }
        ToastUtil.show(R.string.feed_back_success, ToastUtil.LENGTH_SHORT);
        finishEvent.call();

        EventHelper.report(EventId.EVENT_3020100);
    }


}
