import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart' show AppAssets;
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils;
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/PatientERTransportationMethod.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart' show TransportOptionItem;
import 'package:provider/provider.dart';

class AmbulanceOptionSelectionBottomSheet extends StatelessWidget {
  final Function onTap;

  const AmbulanceOptionSelectionBottomSheet({super.key, required this.onTap});
  @override
  Widget build(BuildContext context) {
    return Selector<EmergencyServicesViewModel,
        List<PatientERTransportationMethod>>(
      selector: (_, model) => model.transportationOptions,
      builder: (_, data, __) => Column(
        spacing: 16.h,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Expanded(
            child: ListView.separated(
              separatorBuilder: (_,__)=> SizedBox(
                height: 16.h,
              ),
              itemCount: data.length??0,
              itemBuilder: (_, index) => TransportOptionItem(
                title: Utils.getTextWRTCurrentLanguage(data[index].text, data[index].textN),
                subTitle: "",
                firstIcon:  AppAssets.ambulance,
                middleIcon: AppAssets.to_arrow,
                lastIcon: AppAssets.hospital,
                price: data[index].priceTotal.toString(),
                onTap: () {
                  onTap();
                  context.read<EmergencyServicesViewModel>().setTransportationOption(data[index]);
                },
              ),
            ),
          ),

        ],
      ),
    );
  }
}
