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

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

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

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

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

    default: {
      return state;
    }
  }
}
