import { createAction, props } from '@ngrx/store'; import { BuddyRequest, GroupRequest, GroupDetailData, GroupResponse, UserInfo, RoomRequest, PhoneBookInfo, PhoneBookReadyRequest, PhoneBookReadyResponse, PhoneBookReadyNotification, PhoneBookReadyOkRequest, PhoneBookReadyOkResponse, PhoneBookSndNotification, PhoneBookRcvRequest, PhoneBookRcvResponse } from '@ucap-webmessenger/protocol-sync'; import { RoomInfo, UserInfoShort, UserInfo as RoomUserInfo, InfoRequest } from '@ucap-webmessenger/protocol-room'; import { Info, EventJson } from '@ucap-webmessenger/protocol-event'; import { AddResponse as GroupAddResponse, UpdateRequest as GroupUpdateRequest, UpdateResponse as GroupUpdateResponse, DelRequest as GroupDelRequest, DelResponse as GroupDelResponse } from '@ucap-webmessenger/protocol-group'; import { AddRequest as BuddyAddRequest, AddResponse as BuddyAddResponse, DelRequest as BuddyDelRequest, DelResponse as BuddyDelResponse, UpdateRequest as BuddyUpdateRequest, UpdateResponse as BuddyUpdateResponse } from '@ucap-webmessenger/protocol-buddy'; export const buddy2 = createAction( '[Messenger::Sync] Buddy2', props() ); export const buddy2Success = createAction( '[Messenger::Sync] Buddy2 Success', props<{ buddyList: UserInfo[]; syncDate: string }>() ); export const buddy2Failure = createAction( '[Messenger::Sync] Buddy2 Failure', props<{ error: any }>() ); export const group2 = createAction( '[Messenger::Sync] Group2', props() ); export const group2Success = createAction( '[Messenger::Sync] Group2 Success', props<{ groupList: GroupDetailData[]; syncDate: string }>() ); export const group2Failure = createAction( '[Messenger::Sync] Group2 Failure', props<{ error: any }>() ); export const room = createAction( '[Messenger::Sync] Room', props() ); export const roomSuccess = createAction( '[Messenger::Sync] Room Success', props<{ roomList: RoomInfo[]; roomUserInfoMap: { [param: string]: { userInfoShortList: UserInfoShort[]; userInfoList: RoomUserInfo[]; }; }; syncDate: string; }>() ); export const roomFailure = createAction( '[Messenger::Sync] Room Failure', props<{ error: any }>() ); export const updateRoomForNewEventMessage = createAction( '[Messenger::Sync] updateRoomForNewEventMessage', props<{ roomSeq: string; info: Info; }>() ); export const refreshRoom = createAction( '[Messenger::Sync] refresh room in sync', props() ); export const refreshRoomSuccess = createAction( '[Messenger::Sync] refresh room in sync Success', props<{ roomInfo: RoomInfo; userInfoShortList: UserInfoShort[]; userInfoList: RoomUserInfo[]; }>() ); export const refreshRoomFailure = createAction( '[Messenger::Sync] refresh room in sync Failure', props<{ error: any }>() ); export const updateUnreadCount = createAction( '[Messenger::Sync] Update unread count', props<{ roomSeq: string; noReadCnt?: number; }>() ); /** 새그룹 추가 & 그룹원 추가 */ export const createGroupAndBuddy = createAction( '[Messenger::Sync] Group & Buddy Create', props<{ groupName: string; trgtUserSeq: number[]; }>() ); export const createGroupAndBuddySuccess = createAction( '[Messenger::Sync] Group & Buddy Create Success', props() ); export const createGroupAndBuddyFailure = createAction( '[Messenger::Sync] Group & Buddy Create Failure', props<{ error: any }>() ); /** 그룹원 수정 */ export const updateGroupMember = createAction( '[Messenger::Sync] Update Group Member', props<{ oldGroup: GroupDetailData; trgtUserSeq: number[]; }>() ); export const updateGroupMemberSuccess = createAction( '[Messenger::Sync] Update Group Member Success', props() ); export const updateGroupMemberFailure = createAction( '[Messenger::Sync] Update Group Member Failure', props<{ error: any }>() ); /** 그룹원 이동 */ export const moveGroupMember = createAction( '[Messenger::Sync] Move Group Member', props<{ fromGroup: GroupDetailData; toGroup: GroupDetailData; trgtUserSeq: number[]; }>() ); export const moveGroupToFailure = createAction( '[Messenger::Sync] Move Group Member / To', props<{ error: any }>() ); export const moveGroupFromFailure = createAction( '[Messenger::Sync] Move Group Member / From', props<{ error: any }>() ); /** 동료 추가 */ export const addBuddy = createAction( '[Messenger::Sync] Buddy Add', props() ); export const addBuddySuccess = createAction( '[Messenger::Sync] Buddy Add Success', props() ); export const addBuddyFailure = createAction( '[Messenger::Sync] Buddy Add Failure', props<{ error: any }>() ); /** 동료 삭제 */ export const delBuddy = createAction( '[Messenger::Sync] Buddy Del', props() ); export const delBuddySuccess = createAction( '[Messenger::Sync] Buddy Del Success', props() ); export const delBuddyFailure = createAction( '[Messenger::Sync] Buddy Del Failure', props<{ error: any }>() ); /** 동료 삭제 및 그룹 클리어.(in profile) */ export const delBuddyAndClear = createAction( '[Messenger::Sync] Buddy Del and Group Clear', props<{ seq: number }>() ); export const delBuddyAndClearSuccess = createAction( '[Messenger::Sync] Buddy Del and Group Clear Success', props() ); export const delBuddyAndClearFailure = createAction( '[Messenger::Sync] Buddy Del and Group Clear Failure', props<{ error: any }>() ); /** 동료 변경(즐겨찾기) */ export const updateBuddy = createAction( '[Messenger::Sync] Buddy Update', props() ); export const updateBuddySuccess = createAction( '[Messenger::Sync] Buddy Update Success', props() ); export const updateBuddyFailure = createAction( '[Messenger::Sync] Buddy Update Failure', props<{ error: any }>() ); /** 새그룹 추가 */ export const createGroup = createAction( '[Messenger::Sync] Group Create', props<{ groupName: string; }>() ); export const createGroupSuccess = createAction( '[Messenger::Sync] Group Create Success', props() ); export const createGroupFailure = createAction( '[Messenger::Sync] Group Create Failure', props<{ error: any }>() ); /** 그룹 업데이트 */ export const updateGroup = createAction( '[Messenger::Sync] Group Update', props() ); export const updateGroupSuccess = createAction( '[Messenger::Sync] Group Update Success', props() ); export const updateGroupFailure = createAction( '[Messenger::Sync] Group Update Failure', props<{ error: any }>() ); /** 그룹 삭제 */ export const delGroup = createAction( '[Messenger::Sync] Group Del', props<{ group: GroupDetailData; }>() ); export const delGroupSuccess = createAction( '[Messenger::Sync] Group Del Success', props() ); export const delGroupFailure = createAction( '[Messenger::Sync] Group Del Failure', props<{ error: any }>() ); /** Sync 되어 있는 방의 방인원의 isJoinRoom flag 를 false 로 변경. */ export const clearRoomUsers = createAction( '[Messenger::Sync] Clear room users.', props<{ roomSeq: string; userSeqs: number[] }>() ); /** * PhoneBook Req Sync Date */ export const phoneBookReqSyncDate = createAction( '[Messenger::Sync] PhoneBook Ready Req Sync Date', props<{ syncStartDate: string }>() ); /* PhoneBook Ready*/ export const phoneBookReady = createAction( '[Messenger::Sync] PhoneBook Ready Sync.', props<{ req: PhoneBookReadyRequest }>() ); export const phoneBookReadySuccess = createAction( '[Messenger::Sync] PhoneBook Ready Success', props<{ res: PhoneBookReadyResponse }>() ); export const phoneBookReadyFailure = createAction( '[Messenger::Sync] PhoneBook Ready Failure', props<{ error: any }>() ); /* PhoneBook Ready*/ /* PhoneBook Ready Ok*/ export const phoneBookReadyOk = createAction( '[Messenger::Sync] PhoneBook Ready OK.', props<{ req: PhoneBookReadyOkRequest }>() ); export const phoneBookReadyOkSuccess = createAction( '[Messenger::Sync] PhoneBook Ready OK Success.', props<{ res: PhoneBookReadyOkResponse }>() ); export const phoneBookReadyOkFailure = createAction( '[Messenger::Sync] PhoneBook Ready OK Failure', props<{ error: any }>() ); /* PhoneBook Ready Ok*/ /* PhoneBook Send Noti */ export const phoneBookSndNotification = createAction( '[Messenger::Sync] PhoneBook Send Notification', props<{ noti: PhoneBookSndNotification }>() ); /* PhoneBook Send Noti */ /* PhoneBook Recv */ export const phoneBookRcv = createAction( '[Messenger::Sync] PhoneBook Rcv request', props<{ req: PhoneBookRcvRequest }>() ); export const phoneBookRcvSuccess = createAction( '[Messenger::Sync] PhoneBook Rcv Success', props() ); export const phoneBookRcvFailure = createAction( '[Messenger::Sync] PhoneBook Rcv Failure', props() ); /* PhoneBook Send Noti */