import { getKeyValue } from '../../../helpers/get-key-value';
import { getErrorObject } from '../../../helpers/get-error-object';
import { transformFileUpload } from './items/attachments';
import { transformText } from './items/text';
import { transformSection } from './items/section';

export const methods: {[key: string]: Function} = {
    section: transformSection,
    attachments: transformFileUpload,
    text: transformText,
};

export const getMethods = (type: string): Function => {
    return getKeyValue(methods)(type) || getErrorObject({ type, message: 'Generic to SMS' });
};