import { Selector, createSelector } from '@ngrx/store';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';

// tslint:disable-next-line: no-empty-interface
export interface State {
  loginRes: LoginResponse | null;
  loginFailCount: number;
}

export const initialState: State = {
  loginRes: null,
  loginFailCount: 0
};

export function selectors<S>(selector: Selector<any, State>) {
  return {
    loginRes: createSelector(selector, (state: State) => state.loginRes),
    loginFailCount: createSelector(
      selector,
      (state: State) => state.loginFailCount
    )
  };
}
