import { RPCClientError } from '@loafer/ng-rpc';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { Page } from '@overflow/commons-typescript/model/commons/Page';
import { Sensor } from '@overflow/commons-typescript/model/sensor';

export const sensorAdapter = createEntityAdapter<Sensor, RPCClientError>();

export interface State extends EntityState<Sensor, RPCClientError> {
  page: Page<Sensor>;
}

export const initialState: State = {
  ids : [],
  entities : null,
  page: null,
  error: null,
};

export function getSelectors<S>(selector: Selector<any, State>) {
  return sensorAdapter.getSelectors(selector);
}

