import React from 'react'
import PropTypes from 'prop-types'
import { CardContent } from './CardContent'
import { getCardContentTokens } from './helpers'

/**
 * Renders Card content for the `interactiveCard.selectionType` branch
 * (checkbox / radiogroup selection cards).
 */
export const SelectionContent = ({
  tokens,
  variant,
  withFooter,
  backgroundImage,
  children,
  testID
}) => (
  <CardContent
    tokens={getCardContentTokens(tokens, { backgroundImage })}
    variant={variant}
    withFooter={withFooter}
    backgroundImage={backgroundImage}
    data-testid={testID && `${testID}-card-content`}
  >
    {children}
  </CardContent>
)

SelectionContent.propTypes = {
  tokens: PropTypes.object,
  variant: PropTypes.object,
  withFooter: PropTypes.bool,
  backgroundImage: PropTypes.object,
  children: PropTypes.node,
  testID: PropTypes.string
}
