import { Highlight } from '@/payload-types'


export const highlightLink = (highlight: Highlight) => {
  if(!highlight.link) {
    return undefined
  }

  if (typeof highlight.link.value !== 'object') {
    return undefined
  }

  switch (highlight.link.relationTo) {
    case 'worship':
      return `/gottesdienst/${highlight.link.value.id}`;
    case 'event':
      return `/veranstaltungen/${highlight.link.value.id}`;
    case 'blog':
      return `/blog/${highlight.link.value.id}`;
    default:
      return undefined
  }
}