import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
class RequestStatus extends StatelessWidget {
  final int status;

  const RequestStatus({super.key, required this.status});

  @override
  Widget build(BuildContext context) {
    return AppCustomChipWidget(
      labelText: getTitle(status),
      backgroundColor: getBackgroundColor(status),
      textColor: getTextColor(status),
    );
  }

  String? getTitle(int status) {
    switch (status) {
      case 1: //pending
      case 2: //processing
        return LocaleKeys.underProcessing.tr();
      case 3:
        return LocaleKeys.completedPrescriptionOrder.tr();
      case 4: //cancel
      case 6:
      case 7:
        return LocaleKeys.canceledByPatient.tr();
        break;
    }
    return null;
  }

  Color? getBackgroundColor(int status) {
    switch (status) {
      case 1: //pending
      case 2: //processing
      case 3: //completed
        return AppColors.switchBackgroundColor;
        break;
      case 4: //cancel
      case 6:
      case 7:
        return AppColors.lightRedButtonColor;
        break;
    }
    return null;
  }

  Color? getTextColor(int status) {
    switch (status) {
      case 1: //pending
      case 2:
      case 3: //completed
      return AppColors.successColor;//processing
      case 4: //cancel
      case 6:
      case 7:
        return AppColors.errorColor;
        break;
    }
    return null;
  }
}
