import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:krow/core/presentation/styles/theme.dart';
import 'package:krow/core/presentation/widgets/ui_kit/kw_option_selector.dart';

class WeeklyOptionSelector extends StatefulWidget {
  const WeeklyOptionSelector({
    super.key,
    required this.onWeeklyToggle,
  });

  final void Function(bool) onWeeklyToggle;

  @override
  State<WeeklyOptionSelector> createState() => _WeeklyOptionSelectorState();
}

class _WeeklyOptionSelectorState extends State<WeeklyOptionSelector> {
  int selectedOption = 0;

  @override
  Widget build(BuildContext context) {
    return KwOptionSelector(
      selectedIndex: selectedOption,
      selectedColor: AppColors.blackDarkBgBody,
      itemBorder: const Border.fromBorderSide(
        BorderSide(color: AppColors.grayStroke),
      ),
      onChanged: (index) => setState(() {
        selectedOption = index;
        widget.onWeeklyToggle(selectedOption != 0);
      }),
      items:  ['this_day_only'.tr(), 'entire_schedule'.tr()],
    );
  }
}
