import {
  createActionStructure,
  createAsyncStructure,
  createResourceStructure,
} from 'store/utils/actions';

import constants from './constants';

const actions = {
  ...createResourceStructure(`${constants.prefix}`),
  createRoom: createAsyncStructure(`${constants.prefix}_create_room`),
  addMessageToRoom: createAsyncStructure(`${constants.prefix}_add_message_to_room`),
  getOneRoom: createAsyncStructure(`${constants.prefix}_get_one_room`),
  getRoomsList: createAsyncStructure(`${constants.prefix}_get_rooms_list`),
  markMessagesAsRead: createAsyncStructure(`${constants.prefix}_mark_as_unread`),
  getRoomMessages: createAsyncStructure(`${constants.prefix}_get_room_messages`),
  resetMessageList: createActionStructure(`${constants.prefix}_reset_messageList`),

  // actions
  leaveRoom: createActionStructure(`${constants.prefix}_leave_room`),
};

export default actions;
