//these variables should not changed by the user and will not be saved in storage

import {chatEntity, chatId} from '@caj/components/chat/types';
import {getVersionByNum, VersionType} from '@caj/helper/version';
import {User} from '@caj/user/types';
import {UserId} from './types';

export const APP_VERSION = getVersionByNum(2);
export const AppVarMaxBackups: number = 10;
export const maxCachedUsers = 30;

export enum appStatus {
  IS_LOADING,
  APP_RUNNING,
}

export enum connectionStatus {
  UNKNOWN,
  OFFLINE,
  ONLINE,
  RECONNECTING,
}

export interface NON_SAVE_VARS {
  currentAppVersion: VersionType;
  appStatus: appStatus;
  connectionStatus: connectionStatus;
  cachedUsers: {[key: UserId]: User};
  chats: {[key: chatId]: chatEntity};
  chatActivity: chatId[];
  selectedChat: chatId | 'none';
}

export const non_save_vars: NON_SAVE_VARS = {
  currentAppVersion: APP_VERSION,
  appStatus: appStatus.IS_LOADING,
  connectionStatus: connectionStatus.UNKNOWN,
  cachedUsers: {},
  chats: {},
  chatActivity: [],
  selectedChat: 'none',
};
