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


interface PermissionState {
    wxPubFollow?: boolean | false; //weapp
    pushAllow?: boolean | false;    //rn
    stepAllow?: boolean | false;
    albumAllow?: boolean | false;   //rn
    cameraAllow?: boolean | false;  //rn
    photoAllow?: boolean | false;   //weapp
}

const initialState: PermissionState = {
    wxPubFollow: false,
    pushAllow: false,
    stepAllow: false,
    albumAllow: false,
    cameraAllow: false,
    photoAllow: false,
}

const permissionSlice = createSlice({
    name: 'permission',
    initialState,
    reducers: {
        setWXPubFollow(state, action) {
            state.wxPubFollow = action.payload;
        },
        setPushAllow(state, action) {
            state.pushAllow = action.payload;
        },
        setStepAllow(state, action) {
            state.stepAllow = action.payload;
        },
        setAlbumAllow(state, action) {
            state.albumAllow = action.payload;
        },
        setCameraAllow(state, action) {
            state.cameraAllow = action.payload;
        },
        setPhotoAllow(state, action) {
            state.photoAllow = action.payload;
        },
    }
});

export default permissionSlice.reducer;
export const { setWXPubFollow, setPushAllow, setStepAllow, setCameraAllow, setAlbumAllow, setPhotoAllow } = permissionSlice.actions;