/// Provider: Selected Category Provider
///
/// Manages the currently selected category filter state.
library;

import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'selected_category_provider.g.dart';

/// Selected Category Provider
///
/// Holds the currently selected category ID for filtering products.
/// Default is 'all' which shows all products.
///
/// Usage:
/// ```dart
/// // Read the current value
/// final selectedCategory = ref.watch(selectedCategoryProvider);
///
/// // Update the value
/// ref.read(selectedCategoryProvider.notifier).state = 'floor_tiles';
/// ```
@riverpod
class SelectedCategory extends _$SelectedCategory {
  @override
  String build() {
    return 'all'; // Default: show all products
  }

  /// Update selected category
  void updateCategory(String categoryId) {
    state = categoryId;
  }

  /// Reset to show all products
  void reset() {
    state = 'all';
  }
}
