import { IGenericSection } from "../../../generic/types";
import { ISMSMessage } from "../../types";
import { getMethods } from "../methods";

export const transformMessage = (message: ISMSMessage): IGenericSection => {
   const section: IGenericSection = {
        type: 'section',
        children: []
   };

   const { medias = []} = message?.media;
   if (medias.length) section.children.push(getMethods('attachments')(medias));
   section.children.push(getMethods('text')(message.text));

   return section;
};