package com.dspread.pos.ui.mulberry;

import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.dspread.pos.utils.PosParameters;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class MulberryItemViewModel extends ItemViewModel<MulberryViewModel> {
    // Navigation targets
    public final Integer fragmentId;
    public final Class<?> activityClass;

    // Display properties
    public final ObservableField<String> title = new ObservableField<>();
    public final ObservableField<Object> icon = new ObservableField<>(); // Can be Integer(resId), Bitmap, or String(path)


    // Click handler
    public final BindingCommand itemClick = new BindingCommand(() -> {
        viewModel.onItemClick(this);
    });

    /**
     * Master constructor for all navigation items
     * @param viewModel Parent ViewModel
     * @param title Display title
     * @param iconSource Icon source (resource ID  )
     * @param fragmentId Target fragment ID (null for activity navigation)
     * @param activityClass Target activity class (null for fragment navigation)
     */
    public MulberryItemViewModel(@NonNull MulberryViewModel viewModel,
                                 String title,
                                 Object iconSource,
                                 Integer fragmentId,
                                 Class<?> activityClass) {
        super(viewModel);
        this.fragmentId = fragmentId;
        this.activityClass = activityClass;
        this.title.set(title);
        this.icon.set(iconSource);

    }

}