import {
  SHAPE_ASYNC_STATUS_INITIAL,
  SHAPE_ASYNC_STATUS_REQUESTED,
  SHAPE_ASYNC_STATUS_SUCCEEDED,
  SHAPE_ASYNC_STATUS_FAILED,
  IS_INITIAL,
  IS_BUSY,
  IS_SUCCESSFUL,
  IS_ERROR,
} from '@vincent_za/utils';

export const asyncStates = ({ isList }) => ({
  none: [],
  [IS_INITIAL]: isList ? [SHAPE_ASYNC_STATUS_INITIAL, SHAPE_ASYNC_STATUS_INITIAL] : SHAPE_ASYNC_STATUS_INITIAL,
  [IS_BUSY]: isList ? [SHAPE_ASYNC_STATUS_INITIAL, SHAPE_ASYNC_STATUS_REQUESTED] : SHAPE_ASYNC_STATUS_REQUESTED,
  [IS_SUCCESSFUL]: isList ? [SHAPE_ASYNC_STATUS_INITIAL, SHAPE_ASYNC_STATUS_SUCCEEDED] : SHAPE_ASYNC_STATUS_SUCCEEDED,
  [IS_ERROR]: isList ? [SHAPE_ASYNC_STATUS_INITIAL, SHAPE_ASYNC_STATUS_FAILED(undefined, 'error')] : SHAPE_ASYNC_STATUS_FAILED(undefined, 'error'),
});

export const tooltipPositions = {
  top: 'top',
  right: 'right',
  bottom: 'bottom',
  left: 'left',
};
