import { Selector, createSelector } from '@ngrx/store';
import { User } from 'src/modules/user/model/user.model';

export interface State {
  processing: boolean;
  logined: boolean;
  user: User | null;
}

export const initialState: State = {
  processing: false,
  logined: false,
  user: null,
};

export function getSelectors<S>(selector: Selector<any, State>) {
  return {
    selectProcessing: createSelector(selector, (state: State) => state.processing),
    selectLogined: createSelector(selector, (state: State) => state.logined),
    selectUser: createSelector(selector, (state: State) => state.user),
  };
}
