import {ThemeMode} from '@configs/colors';
import {
  AccountName,
  langCode,
  XAuthorization,
  timestamp,
  Username,
} from '@configs/types';

export enum SourceProp {
  online = -1,
  offline = 0,
  cached = 1,
}

export interface BasicUserProp<T1> {
  source: SourceProp;
  url?: string;
  data?: T1;
}

export type ProfilePictureType = BasicUserProp<Blob | undefined>;

export interface ProfilePicture {
  lq: ProfilePictureType; //low quality
  hq?: ProfilePictureType; //high quality
}

export interface User {
  //UserId: UserId;
  AccountName: AccountName;

  /* ProfilePicture: ProfilePicture;
  lastUpdateTimestamp: timestamp; */
  Username: BasicUserProp<Username> /*
  Description: BasicUserProp<string>;
  FollowersCount: BasicUserProp<number>;
  FollowingCount: BasicUserProp<number>;
  XpLevel: BasicUserProp<number>;
  XpPoints: BasicUserProp<number>; */;
}

export interface MyUserAccount extends User {
  //EMail: EMail;
  SessionId: XAuthorization;
  //WebSocketSessionId: WebSocketSessionId;
  userSettings: userSettings;
}

export interface userSettings {
  theme: ThemeMode;
  lang: langCode;
}

export function createUserProp<T1>(
  source: SourceProp,
  data?: T1,
  url?: string,
): BasicUserProp<T1> {
  return {source, data, url};
}
