/**
 * Image for list item.
 * @class ApListItemImage
 */

'use strict'

import React, { PropTypes as types } from 'react'
import classnames from 'classnames'
import { ApImage } from 'apeman-react-image'

/** @lends ApListItemImage */
const ApListItemImage = React.createClass({

  // --------------------
  // Specs
  // --------------------

  propTypes: {
    src: types.string,
    alt: types.string,
    scale: types.oneOf([ 'fit', 'fill', 'none' ]),
    width: types.oneOfType([ types.number, types.string ]),
    height: types.oneOfType([ types.number, types.string ]),
  },

  mixins: [],

  statics: {},

  getInitialState () {
    return {}
  },

  getDefaultProps () {
    return {
      src: null,
      alt: null,
      width: null,
      height: null,
      scale: 'fill'
    }
  },

  render () {
    const s = this
    let { props } = s

    return (
      <span className={ classnames('ap-list-item-image', props.className) }>
          <ApImage src={ props.src }
                   alt={ props.alt }
                   scale={ props.scale }
                   width={ props.width }
                   height={ props.height }
          />
      </span>
    )
  }

})

export default ApListItemImage
