import { ImageRequireSource } from 'react-native'

export interface ContentItem {
  image: ImageRequireSource
  text: string
  text2: string
}

export const getLoginCarouselContent =
  ({
    onBoarding,
    whatsNew,
  }: {
    onBoarding: ContentItem[]
    whatsNew: Record<string, ContentItem[]>
  }) =>
  (
    currentVersion: string,
    loginCarouselSeenVersion?: string | null
  ): ContentItem[] | null => {
    //If nothing has been shown, show onboarding
    if (!loginCarouselSeenVersion) {
      return onBoarding
    }

    //If current version has been shown, don't show anything
    if (loginCarouselSeenVersion === currentVersion) {
      return null
    }

    //Else Show current version (if available)
    return whatsNew[currentVersion] ?? null
  }
