import {
  TimeOffRequestState,
  TimeOffStepState,
} from '@modules/timeOff/interfaces';

export const getStepState = (
  stepState: TimeOffStepState,
  isPending: boolean,
) => {
  switch (stepState) {
    case TimeOffStepState.APPROVED:
      return TimeOffRequestState.APPROVED;
    case TimeOffStepState.REJECTED:
      return TimeOffRequestState.REJECTED;
    case TimeOffStepState.PENDING:
      return isPending
        ? TimeOffStepState.PENDING
        : TimeOffRequestState.IN_PROGRESS;
    case TimeOffStepState.WAITING_OTHER_STEP:
      return TimeOffRequestState.IN_PROGRESS;
  }
};
