import { integrationActionTypes } from '../action-types/integrations-actions.types';

const initialState = {
  webhookUrl: {},
  apiKey: {},
};
export default (state = initialState, action) => {
  switch (action.type) {
    case integrationActionTypes.CREATE_WEBHOOK:
      return { ...state, createdWebhook: action.payload };
    case integrationActionTypes.GET_WEBHOOK_URL:
      return { ...state, webhookUrl: action.payload };
    case integrationActionTypes.UPDATE_WEBHOOK_URL:
      return { ...state, updateWebhook: action.payload };
    case integrationActionTypes.REMOVE_WEBHOOK:
      return { ...state, removeWebhook: action.paylod };
    case integrationActionTypes.UNINSTALL_APP_VIA_GOOGLE_SHEETS:
      return { ...state, deleteGoogleSheet: action.payload };
    case integrationActionTypes.UNINSTALL_POWERBI_INTEGRATION:
      return { ...state, removePowerbi: action.payload };
    case integrationActionTypes.GET_GENERATED_APIKEYS:
      return { ...state, apiKey: action.payload };
    case integrationActionTypes.DELETE_APIKEYS:
      return { ...state, deleteApiKey: action.payload };
    case integrationActionTypes.RESET_APIKEY:
      return { ...state, resetKey: action.payload };
    default:
      return state;
  }
};
