/**
 * Created by vivek on 22/5/17.
 */
import * as types from './constants';

export function authenticate(user) {
  return {
    type: types.LOGIN_REQUEST,
    user,
  };
}

export function logout() {
  return {
    type: types.LOGOUT_REQUEST_V2,
  };
}

export function changeOrg(orgID) {
  return {
    type: types.SWITCH_ORG_REQUEST,
    orgID,
  };
}

export function addMessageToQueue(message) {
  return {
    type: types.ADD_MESSAGE,
    message,
  };
}

export function removeMessageFromQueue(messageIndex) {
  return {
    type: types.REMOVE_MESSAGE,
    messageIndex,
  };
}

export function getUserData(callback) {
  return {
    type: types.GET_USER_DATA_REQUEST,
    callback,
  };
}

export function fetchSchemaForEntity(queryParams) {
  return {
    type: types.GET_SCHEMA_FOR_ENTITY_REQUEST, queryParams,
  };
}

export function clearMetaEntities() {
  return {
    type: types.CLEAR_META_ENTITIES,
  };
}
export function setInjectedTags(injectedTags) {
  return {
    type: types.SET_INJECTED_TAGS, injectedTags,
  };
}

export function getTopbarMenuData(parentModule) {
  return {
    parentModule,
    type: types.GET_TOPBAR_MENU_DATA_REQUEST,
  };
}

export function clearTopbarMenuData() {
  return {
    type: types.CLEAR_TOPBAR_MENU_DATA,
  };
}

export const getSupportVideosConfig = () => ({
  type: types.GET_SUPPORT_VIDEOS_CONFIG_REQUEST,
});

export const getLiquidTags = (data,callback) => {
  return{
    type: types.GET_LIQUID_TAGS_REQUEST,
    data,
    callback,
  };
};

export const createCentralCommsMetaId = (data, callback) => {
  return {
    type: types.CREATE_CENTRAL_COMMS_META_ID_REQUEST,
    data,
    callback,
  };
};