import { getKeyValue } from '../../../helpers/get-key-value';
import { getErrorObject } from '../../../helpers/get-error-object'; 

import { transformSection } from './items/section';
import { transformText } from './items/text';
import { transformImage } from './items/image';


const methods: { [key: string]: Function } = {
  section: transformSection,
  text: transformText,
  image: transformImage
};

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

export { methods };
