import type { TenantPhoto } from '../../api';
import type { PhotoModerationAction } from './photoModerationQueue';

export type SwipeDirection = 'left' | 'right';

export type SwipeModerationAction = PhotoModerationAction['action'] | null;

export function resolvePhotoSwipeAction(photo: TenantPhoto, direction: SwipeDirection): SwipeModerationAction {
  if (direction === 'right') {
    if (photo.status === 'pending') {
      return 'approve';
    }
    if (photo.status === 'hidden') {
      return 'show';
    }
    return null;
  }

  if (photo.status !== 'hidden') {
    return 'hide';
  }

  return null;
}
