import produce from 'immer';
import reducerRegistry from '~/Utils/reducerRegistry';

export const initialState = {
    picker: {
      show: false,
      mode: "date",
      date: new Date(),
      onChange: () => {},
    },
};

export default function reducer(state = initialState, action = {}) {
    return produce(state, draft => {
        switch (action.type) {
            case SHOW:
                draft.picker = action.payload;
                break;
        }
    });
}

export const SHOW = 'GLOBAL_DATETIME_PICKER/SHOW';
export const showAction = payload => ({ type: SHOW, payload });
