import { FulfillmentDisplayStatus } from '@spiffy-ai/commerce-api-client';

/**
 * Converts a string to a FulfillmentDisplayStatus enum value.
 *
 * @param status - The string to convert.
 *
 * @returns The FulfillmentDisplayStatus enum value or undefined if the string
 * does not map to a valid enum
 */
export const stringToFulfillmentDisplayStatusEnumValue = (
  status: string,
): FulfillmentDisplayStatus | undefined => {
  switch (status) {
    case 'ATTEMPTED_DELIVERY':
      return FulfillmentDisplayStatus.ATTEMPTED_DELIVERY;
    case 'CANCELED':
      return FulfillmentDisplayStatus.CANCELED;
    case 'CONFIRMED':
      return FulfillmentDisplayStatus.CONFIRMED;
    case 'DELIVERED':
      return FulfillmentDisplayStatus.DELIVERED;
    case 'FAILURE':
      return FulfillmentDisplayStatus.FAILURE;
    case 'FULFILLED':
      return FulfillmentDisplayStatus.FULFILLED;
    case 'IN_TRANSIT':
      return FulfillmentDisplayStatus.IN_TRANSIT;
    case 'LABEL_PRINTED':
      return FulfillmentDisplayStatus.LABEL_PRINTED;
    case 'LABEL_PURCHASED':
      return FulfillmentDisplayStatus.LABEL_PURCHASED;
    case 'LABEL_VOIDED':
      return FulfillmentDisplayStatus.LABEL_VOIDED;
    case 'MARKED_AS_FULFILLED':
      return FulfillmentDisplayStatus.MARKED_AS_FULFILLED;
    case 'NOT_DELIVERED':
      return FulfillmentDisplayStatus.NOT_DELIVERED;
    case 'OUT_FOR_DELIVERY':
      return FulfillmentDisplayStatus.OUT_FOR_DELIVERY;
    case 'PICKED_UP':
      return FulfillmentDisplayStatus.PICKED_UP;
    case 'READY_FOR_PICKUP':
      return FulfillmentDisplayStatus.READY_FOR_PICKUP;
    case 'SUBMITTED':
      return FulfillmentDisplayStatus.SUBMITTED;
    case 'IN_PROGRESS':
      return FulfillmentDisplayStatus.IN_PROGRESS;
    case 'ON_HOLD':
      return FulfillmentDisplayStatus.ON_HOLD;
    case 'OPEN':
      return FulfillmentDisplayStatus.OPEN;
    case 'PARTIALLY_FULFILLED':
      return FulfillmentDisplayStatus.PARTIALLY_FULFILLED;
    case 'PENDING_FULFILLMENT':
      return FulfillmentDisplayStatus.PENDING_FULFILLMENT;
    case 'REQUEST_DECLINED':
      return FulfillmentDisplayStatus.REQUEST_DECLINED;
    case 'RESTOCKED':
      return FulfillmentDisplayStatus.RESTOCKED;
    case 'SCHEDULED':
      return FulfillmentDisplayStatus.SCHEDULED;
    case 'UNFULFILLED':
      return FulfillmentDisplayStatus.UNFULFILLED;
    default:
      return undefined;
  }
};
