import { createSelector } from "reselect";

const selectMessaging = (state) => state.messaging;

export const selectChatVisible = createSelector([selectMessaging], (messaging) => messaging.open);

export const selectIsSending = createSelector([selectMessaging], (messaging) => messaging.isSending);

export const selectError = createSelector([selectMessaging], (messaging) => messaging.error);

export const selectSelectedConversation = createSelector(
  [selectMessaging],
  (messaging) => messaging.selectedConversationId
);

export const selectMessage = createSelector([selectMessaging], (messaging) => messaging.message);

export const searchingForConversation = createSelector(
  [selectMessaging],
  (messaging) => messaging.searchingForConversation
);
