/** @module player/state */
// import { call, put, takeEvery, takeLatest } from 'redux-saga/effects'

/**
 * state.js
 *
 * Collection of everything which has to do with state changes.
 **/

/** actionTypes define what actions are handeled by the reducer. */
export const actions = {
  changeTab: activeTab => {
    console.log('change tab')
    return {
      type: 'CHANGE_TAB',
      activeTab
      // alert: {type: 'info', text: 'changed tab.'}
    }
  }
}
console.log('State actions', actions)

/** state definition */
export const state = {
  activeTab: 0
}
console.log('State state', state)

/** reducer is called by the redux dispatcher and handles all component actions */
export function reducer (state = [], action) {
  switch (action.type) {
    case 'CHANGE_TAB':
      return { ...state, activeTab: action.activeTab }
    default:
      return state
  }
}

/** sagas are asynchronous workers (JS generators) to handle the state. */
export function * saga () {}
