import mitt from 'mitt';
import { ObjectType, UserProfile, MessageDto, VisitType } from '@nice/common';
export enum CrudOperation {
  CREATED,
  UPDATED,
  DELETED,
}
type Events = {
  genDataEvent: { type: 'start' | 'end' };
  markDirty: {
    objectType: string;
    id: string;
    staff?: UserProfile;
    subscribers?: string[];
  };
  updateVisitCount: {
    id: string;
    objectType: ObjectType;
    visitType: VisitType;
  };
  updatePostState: {
    id: string;
  };
  onMessageCreated: { data: Partial<MessageDto> };
  dataChanged: { type: string; operation: CrudOperation; data: any };
};
const EventBus = mitt<Events>();
export default EventBus;
