import { Selector, createSelector } from '@ngrx/store';

// tslint:disable-next-line: no-empty-interface
export interface State {
  profileImageRoot: string | null;
  profileImageUploadUrl: string | null;
  fileUploadMaxSize: number | null;
  fileUploadUrl: string | null;
  fileDownloadUrl: string | null;
  serverIp: string | null;
}

export const initialState: State = {
  profileImageRoot: null,
  profileImageUploadUrl: null,
  fileUploadMaxSize: null,
  fileUploadUrl: null,
  fileDownloadUrl: null,
  serverIp: null
};

export function selectors<S>(selector: Selector<any, State>) {
  return {
    profileImageRoot: createSelector(
      selector,
      (state: State) => state.profileImageRoot
    ),
    profileImageUploadUrl: createSelector(
      selector,
      (state: State) => state.profileImageUploadUrl
    ),
    fileUploadMaxSize: createSelector(
      selector,
      (state: State) => state.fileUploadMaxSize
    ),
    fileUploadUrl: createSelector(
      selector,
      (state: State) => state.fileUploadUrl
    ),
    fileDownloadUrl: createSelector(
      selector,
      (state: State) => state.fileDownloadUrl
    ),
    serverIp: createSelector(
      selector,
      (state: State) => state.serverIp
    )
  };
}
