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

function data(state = [], action) {
  switch (action.type) {
    case getSuccessActionType(FETCH_ACTIVE_STUDENT_TYPES):
      return action.payload;
    default:
      return state;
  }
}

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