/**
 * Converter for "share_chat" (group card) message type.
 */

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

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

  return { text: `[Group card: ${chatId}]` }
}
