import 'package:flutter_riverpod/flutter_riverpod.dart';

// UI実験設定クラス
class UiExperimentSettings {
  final int gridColumns;        // 2 or 3
  final String fabAnimation;    // 'rotate' or 'bounce'
  final bool isMapColorful;     // true: Region Colors, false: Posimai/Grey
  final bool showGridText;      // [New] true: Show Text, false: Image Only
  final bool useBadgeIcons;     // [New] true: Lucide Icons, false: Emojis

  const UiExperimentSettings({
    this.gridColumns = 3,
    this.fabAnimation = 'bounce',
    this.isMapColorful = true,
    this.showGridText = true,   // Default to showing text
    this.useBadgeIcons = true,  // Default to Icons (Modern)
  });
  
  UiExperimentSettings copyWith({
    int? gridColumns,
    String? fabAnimation,
    bool? isMapColorful,
    bool? showGridText,
    bool? useBadgeIcons,
  }) {
    return UiExperimentSettings(
      gridColumns: gridColumns ?? this.gridColumns,
      fabAnimation: fabAnimation ?? this.fabAnimation,
      isMapColorful: isMapColorful ?? this.isMapColorful,
      showGridText: showGridText ?? this.showGridText,
      useBadgeIcons: useBadgeIcons ?? this.useBadgeIcons,
    );
  }
}

// Provider (Riverpod 2.0 Notifier)
final uiExperimentProvider = NotifierProvider<UiExperimentNotifier, UiExperimentSettings>(UiExperimentNotifier.new);

class UiExperimentNotifier extends Notifier<UiExperimentSettings> {
  @override
  UiExperimentSettings build() {
    return const UiExperimentSettings();
  }
  
  void setGridColumns(int columns) {
    state = state.copyWith(gridColumns: columns);
  }
  
  void setFabAnimation(String animation) {
    state = state.copyWith(fabAnimation: animation);
  }

  void setMapColorful(bool isColorful) {
    state = state.copyWith(isMapColorful: isColorful);
  }

  void setShowGridText(bool show) {
    state = state.copyWith(showGridText: show);
  }

  void setUseBadgeIcons(bool useIcons) {
    state = state.copyWith(useBadgeIcons: useIcons);
  }
}
