/**
 * ThreadCard component
 *
 * Generated by coz on 2016-12-31,
 * from a template provided by apeman-asset-templates.
 *
 * @function ThreadCard
 */
'use strict'

import React from 'react'
import defineDebug from 'debug'
import Card from './card'

import ThreadImage from '../images/thread_image'
import ThreadCardStyle from '../styles/thread_card_style'
import { asPure, asServed, asLocaled, combine } from '../../wrappers'
const debug = defineDebug('project:fragment:thread-card')

/** @lends ThreadCard */
const ThreadCard = ({
  srvc,
  l,
  thread
}) => {
  const { userNameString } = srvc.localeService
  let imageElm = (
    <ThreadImage thread={ thread }
                 count={ 5 }
                 size={ 128 }
    />
  )
  let styleElm = (
    <ThreadCardStyle prefix={ `#thread-card-${thread.id}` }
                     color={ thread.color }
    />
  )
  return (
    <Card className='thread-card'
          imageElm={ imageElm }
          styleElm={ styleElm }
          id={ `thread-card-${thread.id}` }
          info={ {
            [ l('labels.THREAD_NAME') ]: thread.name,
            [ l('labels.THREAD_DESCRIPTION') ]: thread.description,
            [ l('labels.THREAD_OWNER') ]: userNameString(thread.owner)
          } }
    >
    </Card>
  )
}

export default combine(
  asPure(),
  asServed.proxy(),
  asLocaled.proxy()
)(ThreadCard)
