import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.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/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:provider/provider.dart';

class WaitingAppointmentInfo extends StatelessWidget {
  WaitingAppointmentInfo({super.key});

  late BookAppointmentsViewModel bookAppointmentsViewModel;

  @override
  Widget build(BuildContext context) {
    bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
    return Scaffold(
      backgroundColor: AppColors.bgScaffoldColor,
      body: Column(
        children: [
          Expanded(
            child: CollapsingListView(
              title: LocaleKeys.waitingAppointment.tr(),
              child: SingleChildScrollView(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(height: 24.h),
                    Container(
                      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
                        color: AppColors.whiteColor,
                        borderRadius: 24.h,
                        hasShadow: true,
                      ),
                      child: Padding(
                        padding: EdgeInsets.all(16.h),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Utils.buildSvgWithAssets(icon: AppAssets.waiting_appointment_icon, width: 48.h, height: 48.h, fit: BoxFit.contain),
                            SizedBox(height: 16.h),
                            LocaleKeys.whatIsWaitingAppointment.tr(context: context).toText16(isBold: true),
                            SizedBox(height: 16.h),
                            LocaleKeys.waitingAppointmentsFeature.tr(context: context).toText14(isBold: false),
                            SizedBox(height: 16.h),
                            LocaleKeys.appointmentWithDoctorConfirmed.tr(context: context).toText14(isBold: false),
                            SizedBox(height: 24.h),
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Icon(
                                  Icons.warning,
                                  size: 20,
                                  color: AppColors.warningColorYellow,
                                ),
                                SizedBox(width: 10.w),
                                SizedBox(
                                  width: MediaQuery.of(context).size.width * 0.7,
                                  child: LocaleKeys.paymentWithinTenMinutes.tr(context: context).toText14(isBold: true, color: AppColors.warningColorYellow),
                                ),
                              ],
                            ),
                          ],
                        ),
                      ),
                    ),
                  ],
                ).paddingSymmetrical(24.w, 0),
              ),
            ),
          ),
          Container(
            decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
              color: AppColors.whiteColor,
              borderRadius: 24.h,
              hasShadow: true,
            ),
            child: CustomButton(
              text: LocaleKeys.continueString.tr(),
              onPressed: () async {
                showCommonBottomSheetWithoutHeight(context,
                    title: LocaleKeys.onlineCheckIn.tr(),
                    child: WaitingAppointmentOnlineCheckinSheet(
                      bookAppointmentsViewModel: bookAppointmentsViewModel,
                    ),
                    callBackFunc: () {},
                    isFullScreen: false);
              },
              backgroundColor: AppColors.primaryRedColor,
              borderColor: AppColors.primaryRedColor,
              textColor: AppColors.whiteColor,
              fontSize: 16,
              fontWeight: FontWeight.w600,
              borderRadius: 12,
              padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
              height: 50.h,
              icon: AppAssets.calendar,
              iconColor: AppColors.whiteColor,
              iconSize: 20.h,
            ).paddingSymmetrical(24.h, 24.h),
          ),
        ],
      ),
    );
  }
}
