import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:provider/provider.dart';

/// Age selection page content
class AgeSelectionPage extends StatelessWidget {
  final int? selectedAge;
  final Function(int) onAgeSelected;

  const AgeSelectionPage({
    super.key,
    required this.selectedAge,
    required this.onAgeSelected,
  });

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Consumer<SymptomsCheckerViewModel>(
        builder: (BuildContext context, symptomsViewModel, Widget? child) {
          return Column(
            children: [
              LocaleKeys.dateOfBirthSymptoms.tr(context: context).toText18(isBold: true, color: AppColors.textColor).paddingAll(24.w),
              SizedBox(height: 30.h),
              ThreeColumnDatePicker(
                enableHaptic: true,
                enableSound: true,
                initialDate: symptomsViewModel.dateOfBirth ?? DateTime(2000, 1, 1),
                onDateChanged: (date) {
                  symptomsViewModel.setDateOfBirth(date);
                },
              )
            ],
          );
        },
      ),
    );
  }
}
