import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/appointment_details_resp_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';

import 'dart:ui' as ui;

import '../../../core/utils/utils.dart';
import '../../../theme/colors.dart';

class BuildDoctorRowAppointmentRating extends StatelessWidget {
  final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;

  BuildDoctorRowAppointmentRating({super.key, required this.patientAppointmentHistoryResponseModel});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(16),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Utils.buildImgWithNetwork(
            url: patientAppointmentHistoryResponseModel.doctorImageURL!,
            iconColor: AppColors.transparent,
            width: 63.h,
            height: 63.h,
            fit: BoxFit.cover,
          ).circle(100),
          SizedBox(width: 16.h),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                patientAppointmentHistoryResponseModel.doctorNameObj!.toString().toText16(isBold: true, maxlines: 1),
                SizedBox(height: 8.h),
                Wrap(
                  direction: Axis.horizontal,
                  spacing: 3.h,
                  runSpacing: 4.h,
                  children: [
                    AppCustomChipWidget(
                      labelText: patientAppointmentHistoryResponseModel.projectName.toString(),
                    ),
                    AppCustomChipWidget(
                      labelText: patientAppointmentHistoryResponseModel.clinicName.toString(),
                    ),
                    Directionality(
                      textDirection: ui.TextDirection.ltr,
                      child: AppCustomChipWidget(
                        labelPadding: EdgeInsetsDirectional.only(start: -8.w, end: 6.w),
                        icon: AppAssets.ic_date_filter,
                        labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false),
                        isEnglishOnly: true,
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
