import { IGenericSection, IGenericLink } from '../../../generic/types';
import { IOutputLink } from '../../types';
import { transformText } from './text';

export const transformOutputLink = (msg: IOutputLink): IGenericSection => {
  const link: IGenericLink = {
    type: 'link',
    props: {
      url: msg.value.action
    },
    children: [transformText(msg.label)]
  };

  const result: IGenericSection = {
    type: 'section',
    children: [link]
  };

  return result;
};