import ActionModel from '../ActionModel'
import { LangGlobalModalAN, } from '../constants'
import { LangGlobalModalStateM, } from '../../models/stateModels'
 

const initialState: LangGlobalModalStateM = {
    isShowModal: false,
}


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

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

        case LangGlobalModalAN.TOGGLE_VISIBILITY:
            return { ...state, isShowModal: payload }
    }

    return state
}

export default reducer
