import { createSlice } from "@reduxjs/toolkit";

const initialState: TransectionHistory = {
  userType: "",
  _id: "",
  userId: "",
  type: "",
  amount: 0,
  newBalance: 0,
  currency: "",
  purpose: "",
  status: "",
  createdAt: "",
  updatedAt: "",
  payerId: {
    _id: "",
    email: "",
    firstname: "",
    lastname: "",
    userType: "",
    image: "",
  },
  payeeId: {
    _id: "",
    email: "",
    firstname: "",
    lastname: "",
    userType: "",
    image: "",
  },
  orderStatus: "",
  orderId: "",
  __v: 0,
  commission: undefined,
  platformFee: undefined,
};

export const paymentDetailSlice = createSlice({
  name: "paymentSlice",
  initialState,
  reducers: {
    SinglePaymentDataStore: (state, action) => {
      return { ...state, ...action.payload };
    },
  },
});

export const { SinglePaymentDataStore } = paymentDetailSlice.actions;

export default paymentDetailSlice.reducer;
