import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:flutter/material.dart';

class DiagnosisWidget extends StatelessWidget {
  final UcafViewModel model;
  final GetAssessmentResModel diagnosis;

  DiagnosisWidget(this.model, this.diagnosis);

  @override
  Widget build(BuildContext context) {
    MasterKeyModel diagnosisType = model.findMasterDataById(
        masterKeys: MasterKeysService.DiagnosisType,
        id: diagnosis.diagnosisTypeID);
    MasterKeyModel diagnosisCondition = model.findMasterDataById(
        masterKeys: MasterKeysService.DiagnosisCondition,
        id: diagnosis.conditionID);

    return Column(
      children: [
        CardWithBgWidget(
          bgColor: Colors.transparent,
          widget:  Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              CustomRow(
                label:   "${TranslationBase.of(context).diagnoseType}: ",
                value: diagnosisType != null
                    ? model.selectedLanguage == 'ar'
                    ? diagnosisType.nameAr??""
                    : diagnosisType.nameEn??""
                    : "-",
                valueSize: SizeConfig.textMultiplier! * 1.8,
                labelSize: SizeConfig.textMultiplier! * 1.6,
              ),
              SizedBox(
                height: 4,
              ),
              CustomRow(
                label:   "",
                value: diagnosis.asciiDesc??"",
                valueSize: SizeConfig.textMultiplier! * 1.8,
                labelSize: SizeConfig.textMultiplier! * 1.6,
                isExpanded: true,
              ),
              SizedBox(
                height: 4,
              ),

              CustomRow(
                label:   "${TranslationBase.of(context).condition}: ",
                value:  "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr  ??"": diagnosisCondition.nameEn??"" : "-"}",
                valueSize: SizeConfig.textMultiplier! * 1.8,
                labelSize: SizeConfig.textMultiplier! * 1.6,
              ),
              SizedBox(
                height: 4,
              ),


              CustomRow(
                label: "${TranslationBase.of(context).icd}:",
                value:  "${diagnosis.icdCode10ID}",
                valueSize: SizeConfig.textMultiplier! * 1.8,
                labelSize: SizeConfig.textMultiplier! * 1.6,
              ),

              SizedBox(
                height: 16,
              ),
            ],
          ),
        ),
      ],
    );
  }
}
