import { IGenericSection } from '../../../generic/types';
import { IFileUpload } from "../../types";
import { transformText } from "./text";

export const transformFileUpload = (msg: IFileUpload) => {
  const result: IGenericSection = {
    type: 'section',
    children: []
  };

  if (msg.label) {
    result.children.push(transformText(msg.label));
  }

  const fileSection = {
    type: 'file',
    props: {
      servicenow: {
        type: msg.type
      }
    }
  };

  result.children.push(fileSection);

  return result;
};