import type { FullContact } from '@/lib/contacts/types'

/** Chemin API CardDAV pour PUT/DELETE (sans slash initial). */
export function contactApiPath(contact: Pick<FullContact, 'path' | 'id'>): string {
  let path = (contact.path ?? contact.id).replace(/^\/+/, '')
  if (path.startsWith('cloud/')) {
    path = path.slice('cloud/'.length)
  }
  return path
}
