package com.dspread.pos.ui.cashier;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.viewmodel.CreationExtras;

import com.dspread.pos.common.base.BaseFragment;
import com.dspread.pos.TitleProviderListener;
import com.dspread.pos.ui.main.MainActivity;
import com.dspread.pos.ui.main.MainViewModel;
import com.dspread.pos.ui.mulberry.MulberryViewModel;
import com.dspread.pos_android_app.R;
import com.dspread.pos_android_app.databinding.FragmentCashierBinding;

import com.dspread.pos_android_app.BR;

public class CashierFragment extends BaseFragment<FragmentCashierBinding, CashierViewModel  >
        implements TitleProviderListener{

    @Override
    public void initViewObservable() {
        // Observe item click events
        // Handle fragment navigation

// Observe payment info LiveData
        viewModel.getPaymentInfo().observe(getViewLifecycleOwner(), paymentInfo -> {
            if (paymentInfo != null) {
                Log.d("CashierFragment", "Payment Info Updated: " + paymentInfo);
            }
        });

        // Observe payment status LiveData
        viewModel.getPaymentStatus().observe(getViewLifecycleOwner(), paymentStatus -> {
            Log.d("CashierFragment", "Payment Status Updated: " + paymentStatus);
        });

    }

    @Override
    public String getTitle() {
        return "Cashier";
    }

    @Override
    public int initContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return R.layout.fragment_cashier;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @NonNull
    @Override
    public CreationExtras getDefaultViewModelCreationExtras() {
        return super.getDefaultViewModelCreationExtras();
    }
}
