/*
 *
 * Email actions
 *
 */

import * as types from './constants';

export function createTemplate(template, onCreateTemplateComplete) {
  return {
    type: types.CREATE_TEMPLATE_REQUEST,
    template,
    onCreateTemplateComplete,
  };
}

export function duplicateTemplate(id, channel, callback) {
  return {
    type: types.DUPLICATE_TEMPLATE_REQUEST,
    id,
    channel,
    callback,
  };
}

export function getTemplateDetails(id, channel) {
  return {
    type: types.GET_TEMPLATE_DETAILS_REQUEST,
    id,
    channel,
  };
}

export function getAllAssets(assetType, queryParams) {
  return {
    type: types.GET_ALL_ASSETS_REQUEST,
    assetType,
    queryParams,
  };
}

export function getCmsSetting(cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable) {
  return {
    type: types.GET_CMS_EDITOR_DETAILS_REQUEST,
    cmsType,
    projectId,
    cmsMode,
    langId,
    isEdmSupport,
    isBEEAppEnable,
  };
}

export function getCmsData(cmsType, projectId, langId) {
  return {
    type: types.GET_CMS_EDITOR_DATA_REQUEST,
    cmsType,
    projectId,
    langId,
  };
}

export function clearCRUDResponse() {
  return {
    type: types.CLEAR_EMAIL_CRUD_RESPONSE_REQUEST,
  };
}

export function getCmsAccounts(cmsType) {
  return {
    type: types.GET_CMS_ACCOUNTS_REQUEST,
    cmsType,
  };
}

export function clearStoreValues() {
  return {
    type: types.CLEAR_ALL_VALUES,
  };
}

export function uploadAsset(file, assetType, fileParams) {
  return {
    type: types.UPLOAD_ASSET_REQUEST,
    file,
    assetType,
    fileParams,
  };
}

export function resetCmsData() {
  return {
    type: types.RESET_CMS_EDITOR_DATA,
  };
}

export function transformEmailTemplate(template, callback) {
  return {
    type: types.TRANSFORM_EMAIL_TEMPLATE_REQUEST,
    template,
    callback,
  };
}