import { combineReducers } from 'redux';
import { getSuccessActionType } from '../utils';
import { getErrorReducer, getStatusReducer } from './utils/generators';
import { FETCH_TOP_STUDENT_SCORES } from '../constants/student-score';

function data(state = {}, action) {
  switch (action.type) {
    case getSuccessActionType(FETCH_TOP_STUDENT_SCORES):
      return action.payload;

    default:
      return state;
  }
}

export default combineReducers({
  status: getStatusReducer([FETCH_TOP_STUDENT_SCORES]),
  error: getErrorReducer([FETCH_TOP_STUDENT_SCORES]),
  data
});
