import { ID } from 'src/app/shared/server-services/query-records/common-records';
import {
  MessageRecord,
  ReactionEnum,
} from 'src/app/shared/server-services/query-records/room-records';
import { AccountAvatarRecord } from '../../../shared/server-services/query-records/account-records';

export interface ChatData {
  id: string;
  message: string;
  date: Date;
  account: AccountAvatarRecord;
  edited: boolean;
  error: boolean;
  errorMessage?: string;
  isOwnerOfRoom?: boolean;
  isInGroup?: boolean;
  hasLineBreak?: boolean;
  isOwnMessage?: boolean;

  seenBy?: string[];

  // pass my selected reaction to the reaction-selector
  myReaction?: ReactionEnum | null;
  // maximum reaction
  sumReaction?: number;
  // show the last X reaction
  someReaction?: ReactionEnum[];

  messageRef: MessageRecord;
}

/**
 * Logged in user's permissions to the room itself
 */
export interface ChatPermissions {
  owner?: boolean;
  administrator?: boolean;
  moderator?: boolean;
  noReactions?: null | boolean;
}

/**
 * Locally calculated chat message permission in chat layout
 */
export interface ChatMessagePermission {
  modifyPermission: boolean;
  deletePermission: boolean;
  reactionPermission: boolean;
}
