import 'package:test_sa/app_strings/app_asset.dart';
import 'package:test_sa/models/enums/recurrent_task_inspection_data_type.dart';
import 'package:test_sa/models/enums/swipe_type.dart';
import 'package:test_sa/models/enums/work_order_next_step.dart';

extension EnumExtensionsWorkOrder on WorkOrderNextStepEnum {
  int getIntFromWorkOrderNextStepEnum() {
    switch (this) {
      case WorkOrderNextStepEnum.assignToMe:
        return 2;
      case WorkOrderNextStepEnum.markedAsFixed:
        return 3;
      case WorkOrderNextStepEnum.nTakeAction:
        return 5;

      case WorkOrderNextStepEnum.eRejectAccept:
        return 9;

      case WorkOrderNextStepEnum.eFixRemotelyNeedVisit:
        return 12;

      case WorkOrderNextStepEnum.eArrived:
        return 15;

      case WorkOrderNextStepEnum.verifyAssetDetail:
        return 16;

      case WorkOrderNextStepEnum.activity:
        return 17;

      case WorkOrderNextStepEnum.endWorkFlow:
        return 22;
      case WorkOrderNextStepEnum.assetRetirementManagementApproval:
        return 26;
      case WorkOrderNextStepEnum.waitingForRequesterToConfirm:
        //replace with correct value...
        return 31;
      case WorkOrderNextStepEnum.eFixRemotely:
        return 35;
      case WorkOrderNextStepEnum.eNeedVisit:
        return 36;
    }
  }
}

extension IntExtensionsWorkOrder on int {
  WorkOrderNextStepEnum toWorkOrderNextStepEnum() {
    switch (this) {
      case 2:
        return WorkOrderNextStepEnum.assignToMe;
      case 3:
        return WorkOrderNextStepEnum.markedAsFixed;
      case 5:
        return WorkOrderNextStepEnum.nTakeAction;
      case 9:
        return WorkOrderNextStepEnum.eRejectAccept;
      case 12:
        return WorkOrderNextStepEnum.eFixRemotelyNeedVisit;
      case 15:
        return WorkOrderNextStepEnum.eArrived;
      case 16:
        return WorkOrderNextStepEnum.verifyAssetDetail;
      case 17:
        return WorkOrderNextStepEnum.activity;
      case 22:
        return WorkOrderNextStepEnum.endWorkFlow;
      case 26:
        return WorkOrderNextStepEnum.assetRetirementManagementApproval;
      case 31:
        return WorkOrderNextStepEnum.waitingForRequesterToConfirm;
        case 35:
        return WorkOrderNextStepEnum.eFixRemotely;
        case 36:
        return WorkOrderNextStepEnum.eNeedVisit;
      default:
        return WorkOrderNextStepEnum.assignToMe;
    }
  }

  String getVerificationIconByValue() {
    switch (this) {
      case 1:
        return AppAsset.scanQrIcon;
      case 2:
        return AppAsset.askRequesterIcon;
      case 3:
        return AppAsset.askOtpIcon;
      case 4:
        return AppAsset.takeDevicePhotoIcon;
      case 5:
        return AppAsset.scanQrIcon;
      default:
        return AppAsset.askRequesterIcon;
    }
  }
}



extension EnumExtensionsSwipeType on  SwipeTypeEnum {
  int getIntFromSwipeTypeEnum() {
    switch (this) {
      case SwipeTypeEnum.NFC:
        return 1;
      case SwipeTypeEnum.QR:
        return 2;
      case SwipeTypeEnum.Wifi:
        return 3;
    }
  }
}
extension StringExtensionsRecurrentTaskInpesctionDataType on  String {
  RecurrentTaskInspectionDataTypeEnum toRecurrentTaskInspectionDataTypeEnum() {
    switch (this) {
      case 'bool':
        return RecurrentTaskInspectionDataTypeEnum.bool;
      case 'number':
        return RecurrentTaskInspectionDataTypeEnum.number;
      default:
        return RecurrentTaskInspectionDataTypeEnum.bool;
    }
  }
}
