import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.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/utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class HospitalListItemAdvancePayment extends StatelessWidget {
  final HospitalsModel hospitalModel;
  final bool isLocationEnabled;

  late AppState appState;

  HospitalListItemAdvancePayment({super.key, required this.hospitalModel, required this.isLocationEnabled});

  @override
  Widget build(BuildContext context) {
    appState = getIt.get<AppState>();
    return DecoratedBox(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: AppColors.whiteColor,
        borderRadius: 20.h,
        hasShadow: false,
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              spacing: 8.h,
              children: [hospitalName],
            ),
          ),
          Transform.flip(
            flipX: appState.isArabic() ? true : false,
            child: Utils.buildSvgWithAssets(
              icon: AppAssets.forward_arrow_icon,
              iconColor: AppColors.blackColor,
              width: 18,
              height: 13,
              fit: BoxFit.contain,
            ),
          ),
        ],
      ).paddingSymmetrical(16.h, 16.h),
    );
  }

  Widget get hospitalName => Row(
        children: [
          Utils.buildSvgWithAssets(
            icon: (hospitalModel.isHMC == true) ? AppAssets.hmc : AppAssets.hmg,
          ).paddingOnly(right: 10),
          Expanded(
            child: Text(
              hospitalModel.name ?? "",
              style: TextStyle(
                fontWeight: FontWeight.w600,
                fontSize: 16,
                color: AppColors.blackColor,
              ),
            ),
          )
        ],
      );

// Widget get distanceInfo => Row(
//   children: [
//     Visibility(
//       visible: (hospitalModel.distanceInKMs != "0"),
//       child: AppCustomChipWidget(
//         labelText: "${hospitalData?.distanceInKMs ?? ""} km".needTranslation,
//         deleteIcon: AppAssets.location_red,
//         deleteIconSize: Size(9, 12),
//         backgroundColor: AppColors.secondaryLightRedColor,
//         textColor: AppColors.errorColor,
//       ),
//     ),
//     Visibility(
//         visible: (hospitalData?.distanceInKMs == "0"),
//         child: Row(
//           children: [
//             AppCustomChipWidget(
//               labelText: "Distance not available".needTranslation,
//               textColor: AppColors.blackColor,
//             ),
//             SizedBox(
//               width: 8.h,
//             )
//           ],
//         )),
//     Visibility(
//         visible: !isLocationEnabled,
//         child: AppCustomChipWidget(
//           labelText: "Location turned off".needTranslation,
//           deleteIcon: AppAssets.location_unavailable,
//           deleteIconSize: Size(9, 12),
//           textColor: AppColors.blackColor,
//         )),
//   ],
// );
}
