import { ActionType, Actions } from './meta-probe-version.action';
import {
  State,
  initialState,
  metaProbeVersionEntityAdapter,
} from './meta-probe-version.state';

export function reducer(state: State = initialState, action: Actions): State {
  switch (action.type) {
    case ActionType.ReadAll: {
      return {
        ...state,
      };
    }
    case ActionType.ReadAllSuccess: {
      return metaProbeVersionEntityAdapter.setAll(action.payload, state);
    }
    case ActionType.ReadAllFailure: {
      return metaProbeVersionEntityAdapter.setError(action.payload, state);
    }

    default: {
      return state;
    }
  }
}
