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

const initialState = {
  default_accepted_payment: null,
  currency_type: null,
  site_logo: null,
  company_name: null,
  shipping: null,
  address: null,
  social_media: {},
  pickup: []
};
const generalStore = createSlice({
  name: "GeneralStoreAction",
  initialState: initialState,
  reducers: {
    updateDefaultAcceptedPayment(state, action) {
      state.default_accepted_payment = action.payload.default_accepted_payment;
    },
    updateCurrencyType(state, action) {
      state.currency_type = action.payload.currency_type;
    },
    updateSocialMedia(state, action) {
      state.social_media = action.payload.social_media;
    },
    updateCompanyName(state, action) {
      state.company_name = action.payload.company_name;
    },
    updateSiteLogo(state, action) {
      state.site_logo = action.payload.site_logo;
    },
    updateShipping(state, action) {
      state.shipping = action.payload.shipping;
    },
    updatePickup(state, action) {
      state.pickup = action.payload.pickup;
    },
    updateAddress(state, action) {
      state.address = action.payload.address;
    },
    clearReset(state) {
      state.general = initialState;
    },
  },
});

export const generalStoreActions = generalStore.actions;

export default generalStore;
