import * as actionTypes from '../actions/actionTypes';

const initialState = {
  languageID: 1,
  languageName: 'English',
  feedBackLanguageID:1,
  feedBackLanguageName:'English',
  resource: {},
  apiLink: 'https://uat-api-plugin.ajman.ae/api/create_feedback/', // Production  
  // apiLink: 'http://192.168.100.235:8000/api/create_feedback/', // Test  
  settingsData: 
    {
      "department_code": "dda",
      "name": "Test0",
      "device": "mobile",
      "color": "#FF0000",
      "message": true,
      "selfie": true,
      "audio": true,
      "video": true,
      "plugin_enabled": true
  },
  returnedFeedbackID:0
};

const resourcesReducer = (state = initialState, action) => {
  switch (action.type) {
    case actionTypes.SET_LANGUAGE:
      return {
        ...state,
        languageID: action.languageID,
        languageName: action.languageName,
        resource: action.resource,
      };
    case actionTypes.SET_FEEDBACKID:
      return {
        ...state,
        feedBackLanguageID: action.languageID,
        feedBackLanguageName: action.languageName,
      };
    case actionTypes.SET_SETTINGS_DATA:
      return {
        ...state,
        settingsData: action.data,
      };
      case actionTypes.SET_RETURNED_FEEDBACK_ID:
      return {
        ...state,
        returnedFeedbackID: action.data,
      };
    default:
      return state;
  }
};

export default resourcesReducer;