import { ActionType, Actions } from '../../entity/probe';
import {
  State,
  initialState,
} from './probe-detail.state';

import { Probe } from '@overflow/commons-typescript/model/probe';

export function reducer(state = initialState, action: Actions): State {
  switch (action.type) {
    case ActionType.Read: {
      return {
        ...state,
        pending: true,
      };
    }

    case ActionType.ReadSuccess: {
      return {
        ...state,
        pending: false,
      };
    }

    case ActionType.ReadFailure: {
      return {
        ...state,
        pending: true,
      };
    }

    default: {
      return state;
    }
  }
}
