import { createAction, createReducer } from 'redux-action'

{{#each actionsNames}}
export const {{ constantCase name }}_ACTION = '{{ constantCase name }}_ACTION';
{{/each}}


{{#each actionsNames}}
{{#if sync}}
const {{ camelCase name }}Action = createAction( {{ constantCase name }}_ACTION, data => data );
{{/if}}
{{#if async}}
const {{ camelCase name }}Action = createAction( {{ constantCase name }}_ACTION, (data) => {
    // ...
    return Promise.resolve(data)
})
{{/if}}

{{/each}}


export const actions = {
{{#each actionsNames}}
    {{ camelCase name }}: {{ camelCase name }}Action,
{{/each}}
};

//Actions that need dispatch reference
export const complexActions = {

};

//All actions
export const allActions = {
    ...actions,
    ...complexActions,
};


const initialState = {
// Initial State goes here!
};

const {{ camelCase name }}Reducer = createReducer(initialState, {
{{#each actionsNames}}
    [{{ constantCase name }}_ACTION]: (actionPayload, state) => {
        return state;
    },
{{/each}}
})

export default {{ camelCase name }}Reducer;
