/**
 * Converter for "share_user" (contact card) message type.
 */

import type { ConvertedPayload, MessageConvertContext } from './types'
import { safeParse } from './utils'

export async function convertShareUser(ctx: MessageConvertContext): Promise<ConvertedPayload | null> {
  const parsed = safeParse(ctx.rawContent) as { user_id?: string } | undefined
  const userId = parsed?.user_id
  if (!userId) return null

  return { text: `[Contact card: ${userId}]` }
}
