import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart';
import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sing_chart_and_detials.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';

class VitalSignItemDetailsScreen extends StatelessWidget {
  final VitalSignDetails pageKey;
  final String pageTitle;
  List<Map> VSchart;

  VitalSignItemDetailsScreen({this.vitalList, this.pageKey, this.pageTitle});

  final List<VitalSignResModel> vitalList;

  @override
  Widget build(BuildContext context) {
    switch (pageKey) {
      case VitalSignDetails.BodyMeasurements:
        VSchart = [
          {
            'name': 'Height',
            'title1': 'Date',
            'title2': 'Cm',
            'viewKey': 'HeightCm',
          },
          {
            'name': 'Weight Kg',
            'title1': 'Date',
            'title2': 'Kg',
            'viewKey': 'WeightKg',
          },
          {
            'name': 'BodyMassIndex',
            'title1': 'Date',
            'title2': 'BodyMass',
            'viewKey': 'BodyMassIndex',
          },
          {
            'name': 'HeadCircumCm',
            'title1': 'Date',
            'title2': 'Cm',
            'viewKey': 'HeadCircumCm',
          },
          {
            'name': 'Ideal Body Weight (Lbs)',
            'title1': 'Date',
            'title2': 'Ideal  Weight',
            'viewKey': 'IdealBodyWeightLbs',
          },
          {
            'name': 'LeanBodyWeightLbs (Lbs)',
            'title1': 'Date',
            'title2': 'Lean Weight',
            'viewKey': 'LeanBodyWeightLbs',
          }
        ];

        break;

      case VitalSignDetails.Temperature:
        VSchart = [
          {
            'name': 'Temperature In Celcius',
            'title1': 'Date',
            'title2': 'C',
            'viewKey': 'TemperatureCelcius',
          },
        ];

        break;
      case VitalSignDetails.Pulse:
        VSchart = [
          {
            'name': 'Pulse Beat Per Minute',
            'title1': 'Date',
            'title2': 'Minute',
            'viewKey': 'PulseBeatPerMinute',
          },
        ];

        break;
      case VitalSignDetails.Prescriptions:
        VSchart = [
          {
            'name': 'Respiration Beat Per Minute',
            'title1': 'Date',
            'title2': 'Beat Per Minute',
            'viewKey': 'RespirationBeatPerMinute',
          },
        ];

        break;
      case VitalSignDetails.BloodPressure:
        VSchart = [
          {
            'name': 'Blood Pressure Higher',
            'title1': 'Date',
            'title2': 'Minute',
            'viewKey': 'BloodPressureHigher',
          },
          {
            'name': 'Blood Pressure Lower',
            'title1': 'Date',
            'title2': 'Minute',
            'viewKey': 'BloodPressureLower',
          }
        ];

        break;
      case VitalSignDetails.Respiration:
        VSchart = [
          {
            'name': 'Respiration Rate',
            'title1': 'Date',
            'title2': 'bpm',
            'viewKey': 'RespirationBeatPerMinute',
          },
        ];

        break;
      case VitalSignDetails.heart:
        VSchart = [
          {
            'name': 'FIO2',
            'title1': 'Date',
            'title2': 'bpm',
            'viewKey': 'PulseBeatPerMinute',
          },
        ];

        break;
      case VitalSignDetails.PainScale:
        VSchart = [
          {
            'name': 'PainScore',
            'title1': 'Date',
            'title2': 'Cm',
            'viewKey': 'PainScore',
          },
        ];

        break;
      case VitalSignDetails.Weight:
        VSchart = [
          {
            'name': 'Weight Kg',
            'title1': 'Date',
            'title2': 'Kg',
            'viewKey': 'WeightKg',
          },
        ];

        break;

      case VitalSignDetails.Height:
        VSchart = [
          {
            'name': 'Height Cm',
            'title1': 'Date',
            'title2': 'Cm',
            'viewKey': 'HeightCm',
          },
        ];

        break;
      default:
    }
    return AppScaffold(
      appBarTitle: pageTitle,
      isShowAppBar: true,
      body: ListView(
        children: VSchart.map((chartInfo) {
          var vitalListTemp = vitalList.where(
            (element) => element.toJson()[chartInfo['viewKey']] != null,
          );
          return vitalListTemp.length != 0
              ? VitalSingChartAndDetials(
                  vitalList: vitalList,
                  name: chartInfo['name'],
                  title1: chartInfo['title1'],
                  title2: chartInfo['title2'],
                  viewKey: chartInfo['viewKey'])
              : Container();
        }).toList(),
      ),
    );
  }
}
