import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.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/immediate_livecare/immediate_livecare_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class SelectLiveCareCallType extends StatelessWidget {
  SelectLiveCareCallType({super.key, required this.immediateLiveCareViewModel});

  ImmediateLiveCareViewModel immediateLiveCareViewModel;

  @override
  Widget build(BuildContext context) {
    //TODO: Replace with actual icons
    return Column(
      children: [
        checkInOptionCard(
          AppAssets.livecare_video,
          LocaleKeys.videoCall.tr(context: context),
          LocaleKeys.liveVideoCallWithHMGDoctors.tr(context: context),
        ).onPress(() {
          Navigator.of(context).pop();
          immediateLiveCareViewModel.setLiveCareSelectedCallType(1);
        }),
        SizedBox(height: 16.h),
        checkInOptionCard(
          AppAssets.livecare_audio,
          LocaleKeys.audioCall.tr(context: context),
          LocaleKeys.liveAudioCallWithHMGDoctors.tr(context: context),
        ).onPress(() {
          Navigator.of(context).pop();
          immediateLiveCareViewModel.setLiveCareSelectedCallType(2);
        }),
        SizedBox(height: 16.h),
        checkInOptionCard(
          AppAssets.livecare_phone,
          LocaleKeys.phoneCall.tr(context: context),
          LocaleKeys.livePhoneCallWithHMGDoctors.tr(context: context),
        ).onPress(() {
          Navigator.of(context).pop();
          immediateLiveCareViewModel.setLiveCareSelectedCallType(3);
        }),
      ],
    );
  }

  Widget checkInOptionCard(String icon, String title, String subTitle) {
    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: AppColors.whiteColor,
        borderRadius: 20.r,
        hasShadow: false,
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Utils.buildSvgWithAssets(icon: icon, width: 40.h, height: 40.h, fit: BoxFit.fill, applyThemeColor: false),
          SizedBox(height: 16.h),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    title.toText16(isBold: true, color: AppColors.textColor),
                    subTitle.toText12(isBold: true, color: AppColors.greyTextColor),
                  ],
                ),
              ),
              Transform.flip(
                flipX: getIt.get<AppState>().isArabic(),
                child: Utils.buildSvgWithAssets(
                  icon: AppAssets.forward_arrow_icon_small,
                  iconColor: AppColors.blackColor,
                  width: 18.h,
                  height: 13.h,
                  fit: BoxFit.contain,
                ),
              ),
            ],
          ),
        ],
      ).paddingAll(16.h),
    );
  }
}
