import { RequestStatusEnum, type STATUS_CODE } from "@/types/index";

export function getOrderStatus(statusCode: STATUS_CODE) {
	const isPending =
		statusCode < RequestStatusEnum.EXTRACTED || statusCode === undefined;

	const inProgress = statusCode === RequestStatusEnum.EXTRACTED;

	const isCompleted =
		statusCode >= RequestStatusEnum.COMPLETED &&
		statusCode < RequestStatusEnum.EXPIRED;

	const isExpired = statusCode === RequestStatusEnum.EXPIRED;

	const isReverted = statusCode === RequestStatusEnum.REVERTED;

	return { isPending, inProgress, isCompleted, isExpired, isReverted };
}
