/*
 *
 * Facebook actions
 *
 */

import {
  GET_MARKETING_OBJECTIVES,
  UPLOAD_FB_AD_ASSET_REQUEST,
  CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
  EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
  GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
  CLEAR_FACEBOOK_AD_ASSET,
  CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
  CLEAR_FACEBOOK_AD_DATA,
  CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
  GET_ORG_OU_LIST_REQUEST,
} from './constants';

export const getMarketingObjectives = () => ({
  type: GET_MARKETING_OBJECTIVES,
});

export const uploadFbAdAsset = (file, assetType, fileParams, templateType, videoData) => ({
  type: UPLOAD_FB_AD_ASSET_REQUEST,
  file,
  assetType,
  fileParams,
  templateType,
  videoData,
});

export const createTemplate = (template, callback) => ({
  type: CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
  template,
  callback,
});

export const getOrgOUs = (orgID) => ({
  type: GET_ORG_OU_LIST_REQUEST,
  orgID,
});

// FOR EDIT

export const editTemplate = (template, callback) => ({
  type: EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
  template,
  callback,
});

export const getTemplateDetails = (id, callback) => ({
  type: GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
  id,
  channel: 'FACEBOOK',
  callback,
});

export const clearData = () => ({
  type: CLEAR_FACEBOOK_AD_DATA,
});

export const clearEditResponse = () => ({
  type: CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
});


export const clearCreateResponse = () => ({
  type: CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
});

export const clearFbAdAsset = (templateType) => ({
  type: CLEAR_FACEBOOK_AD_ASSET,
  templateType,
});

