import ActionModel from '../ActionModel'
import { Tab_2_PageStateM, } from '../../models/stateModels'
import { Tab_2_PageAN, } from '../constants'
 

const initialState: Tab_2_PageStateM = {
    notifications: [
        { senderName: '', notificationText: '', selectedTimeIndex: 0, timeValue: 5 },
    ]
}


var reducer = function(state = initialState, action: ActionModel)
{
    let { payload } = action

    switch(action.type)
    {
        case Tab_2_PageAN.SET_STATE:
            return { ...state, ...payload }

        // case NotificationActionNames.ADD_NOTIFICATION:
        //     return [...state, payload]

        // case NotificationActionNames.DELETE_NOTIFICATION:
        //     return state.filter((_, i) => i != payload)

        // case NotificationActionNames.UPDATE_NOTIFICATION:
        //     state[payload.index] = payload.notification
        //     return [...state]
    }

    return state
}

export default reducer
