import { RPCClientError } from '@loafer/ng-rpc/protocol';

import { Probe } from '../../model';

// export interface State {
//   error: RPCError | null;
//   isPending: boolean;
//   probe: Probe | null;
// }

// export const initialState: State = {
//   error: null,
//   isPending: false,
//   probe: null,
// };


import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity';

export interface State extends EntityState<Probe> {
  error: RPCClientError | null;
  isPending: boolean;
  probe: Probe | null;
}
export const adapter: EntityAdapter<Probe> = createEntityAdapter<Probe>();
export const initialState: State = adapter.getInitialState({
  error: null,
  isPending: false,
  probe: null,
});

export const getProbe = (state: State) => state.probe;
export const getError = (state: State) => state.error;
export const isPending = (state: State) => state.isPending;

// export const {
//   selectIds,
//   selectEntities,
//   selectAll,
//   selectTotal,
// } = adapter.getSelectors();
