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

interface HealthState {
    windows: any;
    mode: string;
    selTab: number;
    refreshs: any; //刷新数据时间点
    title: string;
    eatArchived:any;
}

const initialState: HealthState = {
    windows: null,
    mode: 'DAY',
    selTab: 0,
    refreshs: [],
    title: '',
    eatArchived:null,
}

const healthSlice = createSlice({
    name: 'health',
    initialState,
    reducers: {

        setWindows(state, action) {
            state.windows = action.payload
        },
        setMode(state, action) {
            state.mode = action.payload
        },
        setTab(state, action) {
            state.selTab = action.payload
        },
        setRefreshs(state, action) {
            state.refreshs = action.payload
        },
        setTitle(state, action) {
            state.title = action.payload
        },
        setEatArchived(state,action){
            state.eatArchived = action.payload
        }

    }
})




export const { setWindows, setMode, setTab, setRefreshs,setTitle,setEatArchived } = healthSlice.actions;
export default healthSlice.reducer;