/// Provider: Search Query Provider
///
/// Manages the current search query state for product filtering.
library;

import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'search_query_provider.g.dart';

/// Search Query Provider
///
/// Holds the current search query string for filtering products.
/// Default is empty string which shows all products.
///
/// Usage:
/// ```dart
/// // Read the current value
/// final searchQuery = ref.watch(searchQueryProvider);
///
/// // Update the value
/// ref.read(searchQueryProvider.notifier).state = 'gạch men';
/// ```
@riverpod
class SearchQuery extends _$SearchQuery {
  @override
  String build() {
    return ''; // Default: no search filter
  }

  /// Update search query
  void updateQuery(String query) {
    state = query;
  }

  /// Clear search query
  void clear() {
    state = '';
  }
}
