import 'package:rasadyar_core/core.dart';

class SearchLogic extends GetxController {
  final RxBool isSearchSelected = false.obs;

  final RxnString searchValue = RxnString();

  void setSearchCallback(void Function(String)? onSearchChanged) {
    debounce<String?>(searchValue, (val) {
      if (val != null && val.trim().isNotEmpty) {
        onSearchChanged?.call(val);
      }
    }, time: const Duration(milliseconds: 600));
  }

  void toggleSearch() {
    isSearchSelected.value = !isSearchSelected.value;
  }


}
