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

/**
 * Return location as readable string
 */
export const locationString = (location: Location | string) => {
  if (typeof location === 'string') {
    return "Unbekannt";
  }

  let s = location.name;

  if(location.address) {
    s += '\n' + location.address;
  }

  if(location.notes) {
    s += '\n' + location.notes;
  }

  return s;
}