import { Link } from '../atoms/link.js'
import { ValidationError } from '../routing/error-handler.js'
import h from '../shared/h.js'

export function LegalFooter ({ _model, ...props }) {
  const { links } = _model
  if (links.length === 0) {
    throw new ValidationError()
  }

  return h('div', { ...props, className: 'p-6 text-sm flex flex-wrap gap-5', role: 'list' }, links.map(link =>
    h('div', { role: 'listitem', className: 'flex items-center' },
      h(Link, { _variant: 'simple', _model: link, className: 'text-sm' })
    )
  ))
}
