import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/patient_physical_examination.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../../../utils/translations_delegate_base_utils.dart';

class ListOfExamination extends StatelessWidget {
  final List<PatientPhysicalExamination> listOfSelection;

  const ListOfExamination({super.key, required this.listOfSelection});

  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);
    return Flexible(
      child: ListView.separated(
        physics: NeverScrollableScrollPhysics(),
        shrinkWrap: true,
          itemBuilder: (_, index) => SoapDetailItem(
                title: "${listOfSelection[index].specialityDescription}>${listOfSelection[index].physicalExaminationDescription}",
                condition: getCondition(listOfSelection[index].physicalExaminationCondition ?? 3, context)??TranslationBase.of(context).notExamined,
                remarks:  listOfSelection[index].remark??'',
                onSoapDetailActionClicked: (action) {
                  ///todo handle the event as per the actiion
                  /// the action is [SoapDetailItemActions]
                },
                status: TranslationBase.of(context).active,
            showActions: false,
              ),
          separatorBuilder: (_, __) => Divider(),
          itemCount: listOfSelection.length),
    );
  }

  String? getCondition(int condition, BuildContext context) => condition == 1
        ? TranslationBase.of(context).normal
        : condition == 2
        ? TranslationBase.of(context).abnormal
        : TranslationBase.of(context).notExamined;
}
