import { EventType } from '../types/event.type';

export interface Info<T = {}> {
  // 이벤트SEQ
  seq: number;
  // 이벤트타입
  type: EventType;
  // 발신자SEQ
  senderSeq: number;
  // 발신일시
  sendDate: string;
  // 발신내용
  sentMessage: string;
  // // 발신내용
  sentMessageJson?: T;
  // 수신자수
  receiverCount: number;
}

export function isCopyable(eventType: EventType): boolean {
  return (
    EventType.Character === eventType || EventType.Translation === eventType
  );
}

export function isRecalled(eventType: EventType): boolean {
  return EventType.RecalledMessage === eventType;
}

export function isRecallable(event: Info<any>, userSeq: number): boolean {
  return (
    event.senderSeq === userSeq && event.type !== EventType.RecalledMessage
  );
}
