/**
 * Mixin to add uuid.
 * @mixin ApUUIDMixin
 */

'use strict'

import React, {PropTypes as types} from 'react'
import uuid from 'uuid'

/** @lends ApUUIDMixin */
let ApUUIDMixin = {

  // --------------------
  // Custom
  // --------------------
  $apUUIDMixed: true,

  uuid: null,

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

  // --------------------
  // Lifecycle
  // --------------------

  componentWillMount () {
    const s = this
    s.uuid = s.uuid || uuid.v4()
  }
}

export default Object.freeze(ApUUIDMixin)
