import React from 'react'

import RichCardCard from './RichCardCard'
import type { RichCardBaseProps } from './types'

/** Props for `RichCard.Sent` / `RichCard.Received`. */
export type RichCardSentCardProps = RichCardBaseProps
export type RichCardReceivedCardProps = RichCardBaseProps

const SentCard: React.FC<RichCardSentCardProps> = (props) => (
  <RichCardCard {...props} variant="dark" />
)

const ReceivedCard: React.FC<RichCardReceivedCardProps> = (props) => (
  <RichCardCard {...props} variant="light" />
)

/**
 * The generic rich message card (`linktree_rich_card`) — the shared render
 * primitive for rich message surfaces. Render `RichCard.Sent` for the sender's
 * own copy (dark chrome) and `RichCard.Received` in the recipient's thread
 * (light chrome). The official welcome card and broadcast link/collection cards
 * are all this one card at different knobs:
 *
 *   - `hero` + `primary` action → the official welcome card (stacked button)
 *   - `hero` + `secondary` action → a single-link broadcast (inline button)
 *   - `fan` + `secondary` action → a collection broadcast
 *
 * A standalone renderer, not tied to Stream's `Attachment`: the dispatching
 * consumer narrows an attachment with the taxonomy's `isRichCard`, then maps
 * the taxonomy `RichCard` fields onto these props (resolving each action's
 * `kind` to an `href` / `onClick`).
 */
const RichCard = {
  Sent: SentCard,
  Received: ReceivedCard,
}

export default RichCard
export type {
  RichCardBaseProps,
  RichCardActionButton,
  RichCardImagePresentation,
} from './types'
