import { createAction, props } from '@ngrx/store';
import { Info, EventJson } from '@ucap-webmessenger/protocol-event';
import {
  MassTalkDownloadRequest,
  MassTalkDownloadResponse
} from '@ucap-webmessenger/api-common';
import { RightDrawer } from '@app/types';

export const selectedRoom = createAction(
  '[Messenger::Chat] selectedRoom',
  props<{ roomSeq: string }>()
);

export const clearSelectedRoom = createAction(
  '[Messenger::Chat] clearSelectedRoom'
);

export const newEventMessage = createAction(
  '[Messenger::Chat] newEventMessage',
  props<{
    roomSeq: string;
    info: Info<EventJson>;
  }>()
);

export const selectedMassDetail = createAction(
  '[Messenger::Chat] selectedMassDetail',
  props<{ massEventSeq: number }>()
);
export const massTalkDownload = createAction(
  '[Messenger::Chat] massTalkDownload',
  props<MassTalkDownloadRequest>()
);
export const massTalkDownloadSuccess = createAction(
  '[Messenger::Chat] massTalkDownload Success',
  props<MassTalkDownloadResponse>()
);
export const massTalkDownloadFailure = createAction(
  '[Messenger::Chat] massTalkDownload Failure',
  props<{ error: any }>()
);

export const openRoom = createAction(
  '[Messenger::Chat] Open Room',
  props<{ userSeqList: number[]; isTimeRoom?: boolean }>()
);

export const selectedRightDrawer = createAction(
  '[Messenger::Chat] Selected Right Drawer',
  props<{ req: RightDrawer }>()
);
export const clearRightDrawer = createAction(
  '[Messenger::Chat] Clear Right Drawer',
  props()
);
