package com.datarecovery.master.dialog;

import android.content.Context;

import androidx.annotation.NonNull;

import com.datarecovery.master.dialog.BaseDialog;
import com.datarecovery.master.R;
import com.datarecovery.master.databinding.DialogMemberRetentionBinding;

@BaseDialog.FullScreen
public class MemberRetentionDialog extends BaseDialog<DialogMemberRetentionBinding> {

    private ActionHandler actionHandler;

    public MemberRetentionDialog(@NonNull Context context) {
        super(context, R.style.Theme_Common_Dialog);
        setCancelable(false);
        binding.setOnCloseClickListener(v -> {
            if (actionHandler != null) {
                actionHandler.onCloseClick();
            }
            dismiss();
        });
        binding.setOnContinueClickListener(v -> {
            if (actionHandler != null) {
                actionHandler.onContinueClick();
            }
            dismiss();
        });
    }

    public MemberRetentionDialog setActionHandler(ActionHandler actionHandler) {
        this.actionHandler = actionHandler;
        return this;
    }

    public interface ActionHandler {
        void onCloseClick();

        void onContinueClick();
    }
}
