import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { SendMessageData } from "../../types/SendMessageType";

const initialState: SendMessageData = {
  to_user: 0,
  url:"",
  message: "",
};

// Create a slice of the state
const SendMessageSlice = createSlice({
  name: "SendMessageData",
  initialState,
  reducers: {
    // Reducer to update the MessageList
    updateSendMessageData(
      state,
      action: PayloadAction<Partial<SendMessageData>>,
    ) {
      return { ...state, ...action.payload };
    },
  },
});

// Export the reducer and actions
export default SendMessageSlice.reducer;
export const { updateSendMessageData } = SendMessageSlice.actions;
