/*
 *
 * Create actions
 *
 */

import * as types from './constants';

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

export function clearCreateResponse() {
  
  return {
    type: types.CLEAR_CREATE_RESPONSE_REQUEST,
  };
}

export function defaultAction() {
  return {
    type: types.DEFAULT_ACTION,
  };
}

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

export function clearAsset(templateType) {
  return {
    type: types.CLEAR_ASSET,
    templateType,
  };
}


// FOR EDIT


export function editTemplate(template, callback) {
  
  return {
    type: types.EDIT_TEMPLATE_REQUEST,
    template,
    callback,
  };
}

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

export function clearEditResponse() {
  
  return {
    type: types.CLEAR_EDIT_RESPONSE_REQUEST,
  };
}

export function clearData() {
  return {
    type: types.CLEAR_DATA,
  };
}

export function getLineTemplatesList(channel, queryParams) {
  return {
    type: types.GET_LINE_TEMPLATES_LIST_REQUEST,
    channel,
    queryParams,
  };
}

export function setSelectedTemplate(templateData) {
  return {
    type: types.SET_SELECTED_TEMPLATE,
    data: templateData,
  };
}

export const getLineStickers = () => ({
  type: types.GET_STICKER_REQUEST,
})
